Skip to content

Commit

Permalink
fix(files): Adjust babel module resolution
Browse files Browse the repository at this point in the history
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
  • Loading branch information
susnux committed Jun 11, 2024
1 parent 1dfa923 commit 0bd7011
Show file tree
Hide file tree
Showing 4 changed files with 161 additions and 1 deletion.
10 changes: 10 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ module.exports = {
plugins: [
'@babel/plugin-syntax-dynamic-import',
'@babel/plugin-proposal-class-properties',
// We need the bundler entry not the web one
// Jest will otherwise resolve the wrong one
[
"module-resolver",
{
"alias": {
"webdav": "webdav/dist/node/index.js",
},
},
]
],
presets: [
// https://babeljs.io/docs/en/babel-preset-typescript
Expand Down
6 changes: 5 additions & 1 deletion jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ const ignorePatterns = [
'@buttercup/fetch',
'@juliushaertl',
'@mdi/svg',
'@nextcloud/files',
'@nextcloud/upload',
'@nextcloud/vue',
'ansi-regex',
'camelcase',
'char-regex',
'hot-patcher',
'is-svg',
'layerr',
'mime',
'p-cancelable',
'p-limit',
Expand All @@ -26,6 +28,7 @@ const ignorePatterns = [
'strip-ansi',
'tributejs',
'unist-.+',
'url-join',
'vue-material-design-icons',
'webdav',
'yocto-queue',
Expand All @@ -49,7 +52,7 @@ const config: Config = {

transform: {
// process `*.js` files with `babel-jest`
'^.+\\.js$': 'babel-jest',
'^.+\\.c?js$': 'babel-jest',
'^.+\\.vue$': '@vue/vue2-jest',
'^.+\\.ts$': ['ts-jest', {
// @see https://github.com/kulshekhar/ts-jest/issues/4081
Expand All @@ -65,6 +68,7 @@ const config: Config = {
'^.+\\.svg(\\?raw)?$': '<rootDir>/__mocks__/svg.js',
'\\.s?css$': '<rootDir>/__mocks__/css.js',
},

modulePathIgnorePatterns: [
'<rootDir>/apps2/',
'<rootDir>/apps-extra/',
Expand Down
145 changes: 145 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
"babel-jest": "^29.6.4",
"babel-loader": "^9.1.0",
"babel-loader-exclude-node-modules-except": "^1.2.1",
"babel-plugin-module-resolver": "^5.0.2",
"colord": "^2.9.3",
"css-loader": "^6.8.1",
"cypress": "^13.7.2",
Expand Down

0 comments on commit 0bd7011

Please sign in to comment.