Skip to content

Commit

Permalink
Fix jest conf,
Browse files Browse the repository at this point in the history
  • Loading branch information
stories2 committed Nov 10, 2021
1 parent 3e9a835 commit 5eb63bc
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
7 changes: 6 additions & 1 deletion test/unit/jest.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,13 @@ module.exports = {
'.*\\.(vue)$': '<rootDir>/node_modules/vue-jest'
},
testPathIgnorePatterns: [
'<rootDir>/test/e2e'
'<rootDir>/test/e2e',
'/node_modules/*',
'/node_modules',
'<rootDir>/node_modules/*',
'<rootDir>/node_modules/(?!(@firebase.*)/)'
],
resolver: '<rootDir>/test/unit/my-module-resolve.js',
snapshotSerializers: ['<rootDir>/node_modules/jest-serializer-vue'],
setupFiles: ['<rootDir>/test/unit/setup'],
mapCoverage: true,
Expand Down
19 changes: 19 additions & 0 deletions test/unit/my-module-resolve.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// my-module-resolve.js
module.exports = (request, options) => {
// Call the defaultResolver, so we leverage its cache, error handling, etc.
return options.defaultResolver(request, {
...options,
// Use packageFilter to process parsed `package.json` before the resolution (see https://www.npmjs.com/package/resolve#resolveid-opts-cb)
packageFilter: pkg => {
if (pkg.name.startsWith('@firebase')) {
return {
...pkg,
// Alter the value of `main` before resolving the package
main: pkg.esm5 || pkg.module
}
}

return pkg
}
})
}

0 comments on commit 5eb63bc

Please sign in to comment.