-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathjest.resolver.js
32 lines (30 loc) · 960 Bytes
/
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
// jest.resolver.js
module.exports = (path, options) => {
// Call the defaultResolver, so we leverage its cache, error handling, etc.
return options.defaultResolver(path, {
...options,
// Use packageFilter to process parsed `package.json` before the resolution (see https://www.npmjs.com/package/resolve#resolveid-opts-cb)
packageFilter: (pkg) => {
const pkgNamesToTarget = new Set([
"@firebase/auth",
"@firebase/analytics",
"@firebase/storage",
"@firebase/functions",
"@firebase/database",
"@firebase/auth-compat",
"@firebase/database-compat",
"@firebase/app-compat",
"@firebase/firestore",
"@firebase/firestore-compat",
"@firebase/messaging",
"@firebase/util",
"firebase",
]);
if (pkgNamesToTarget.has(pkg.name)) {
delete pkg["exports"];
delete pkg["module"];
}
return pkg;
},
});
};