-
Notifications
You must be signed in to change notification settings - Fork 80
/
jest.resolver.js
36 lines (35 loc) · 1.02 KB
/
jest.resolver.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
const nxResolver = require('@nrwl/jest/plugins/resolver')
/**
* Override for the Nx Jest resolver to ensure we import the correct uuid and firebase packages.
* @see https://jestjs.io/docs/upgrading-to-jest28#packagejson-exports
* @param {string} path
* @param {any} options
* @returns Nx Jest resolver with custom package filter
*/
module.exports = (path, options) => {
return nxResolver(path, {
...options,
packageFilter(pkg) {
// Fix: uuid is resolving to its esm build
if (pkg.name === 'uuid') {
delete pkg['exports']
delete pkg['module']
}
// Fix: firebase is resolving to its esm builds
if (
pkg.name === 'firebase' ||
pkg.name === 'firebase-admin' ||
pkg.name.startsWith('@firebase/')
) {
delete pkg['exports']
delete pkg['module']
}
// Fix: msgpackr is resolving to its esm build
if (pkg.name === 'msgpackr') {
delete pkg['exports']
delete pkg['module']
}
return pkg
},
})
}