Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Jest config to avoid transpiling dependencies #16068

Merged
merged 2 commits into from
Oct 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,11 @@ module.exports = {
testTimeout: 2500,
// We have to specify the environment we are running in, which is jsdom. The
// default is 'node'. This can be modified *per file* using a comment at the
// head of the file. So it may be worth while to switch to 'node' in any
// head of the file. So it may be worthwhile to switch to 'node' in any
// background tests.
testEnvironment: 'jsdom',
// Our configuration somehow is calling into the esm folder / files of
// some modules. Jest supports ESM but our code is not set to emit ESM files
// so we are telling jest to use babel to transform the node_modules listed.
// Note: for some reason I could not hammer down to the node_modules
// installed in @metamask/controllers so I had to just blanket specify all
// of the @metamask/controllers folder.
transformIgnorePatterns: [
'/node_modules/(?!(multiformats|uuid|nanoid|@metamask/controllers|@metamask/snap-controllers|@metamask/rpc-methods)/)',
],
testEnvironmentOptions: {
customExportConditions: ['node', 'node-addons'],
},
workerIdleMemoryLimit: '500MB',
};
3 changes: 3 additions & 0 deletions jest.stories.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@ module.exports = {
'^.+\\.mdx$': '@storybook/addon-docs/jest-transform-mdx',
},
testEnvironment: 'jsdom',
testEnvironmentOptions: {
customExportConditions: ['node', 'node-addons'],
},
};
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@
"@metamask/providers": "^9.0.0",
"@metamask/rpc-methods": "^0.21.0",
"@metamask/slip44": "^2.1.0",
"@metamask/smart-transactions-controller": "^2.3.2",
"@metamask/snap-controllers": "^0.21.0",
"@metamask/snap-utils": "^0.21.0",
"@metamask/smart-transactions-controller": "^2.3.2",
"@ngraveio/bc-ur": "^1.1.6",
"@popperjs/core": "^2.4.0",
"@reduxjs/toolkit": "^1.6.2",
Expand Down Expand Up @@ -350,9 +350,9 @@
"history": "^5.0.0",
"improved-yarn-audit": "^3.0.0",
"ini": "^3.0.0",
"jest": "^29.0.0-alpha.5",
"jest": "^29.1.2",
"jest-canvas-mock": "^2.3.1",
"jest-environment-jsdom": "^29.0.0-alpha.4",
"jest-environment-jsdom": "^29.1.2",
"jest-it-up": "^2.0.2",
"jsdom": "^11.2.0",
"koa": "^2.7.0",
Expand Down
Loading