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 test config to leverage swc #28400

Merged
merged 6 commits into from Aug 23, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
35 changes: 35 additions & 0 deletions jest.config.js
Expand Up @@ -7,4 +7,39 @@ module.exports = {
globalTeardown: '<rootDir>/jest-global-teardown.js',
setupFilesAfterEnv: ['<rootDir>/jest-setup-after-env.js'],
testEnvironment: '<rootDir>/jest-environment.js',
transformIgnorePatterns: ['/node_modules/', '/next[/\\\\]dist/'],
transform: {
'.+\\.(t|j)sx?$': [
// this matches our SWC options used in https://github.com/vercel/next.js/blob/canary/packages/next/taskfile-swc.js
'@swc/jest',
{
module: {
type: 'commonjs',
},
env: {
targets: {
node: '12.0.0',
},
},
jsc: {
loose: true,

parser: {
syntax: 'typescript',
dynamicImport: true,
tsx: true,
},
transform: {
react: {
pragma: 'React.createElement',
pragmaFrag: 'React.Fragment',
throwIfNamespace: true,
development: false,
useBuiltins: true,
},
},
},
},
],
},
}
5 changes: 2 additions & 3 deletions package.json
Expand Up @@ -51,6 +51,7 @@
"@mdx-js/loader": "0.18.0",
"@svgr/webpack": "5.5.0",
"@swc/core": "1.2.80",
"@swc/jest": "0.2.2",
"@testing-library/react": "11.2.5",
"@types/cheerio": "0.22.16",
"@types/fs-extra": "8.1.0",
Expand All @@ -68,8 +69,6 @@
"alex": "9.1.0",
"amphtml-validator": "1.0.33",
"async-sema": "3.0.1",
"babel-core": "7.0.0-bridge.0",
"babel-jest": "27.0.0-next.5",
"browserslist": "^4.14.7",
"browserstack-local": "1.4.0",
"cheerio": "0.22.0",
Expand Down Expand Up @@ -98,7 +97,7 @@
"image-size": "0.9.3",
"is-animated": "2.0.0",
"isomorphic-unfetch": "3.0.0",
"jest": "27.0.0-next.8",
"jest": "27.0.6",
"ky": "0.19.1",
"ky-universal": "0.6.0",
"lerna": "4.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/next/compiled/@vercel/nft/index.js

Large diffs are not rendered by default.