-
Notifications
You must be signed in to change notification settings - Fork 31
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
[ARGG-773]: Changes to support testing with Jest 29 #176
Conversation
@@ -21,8 +21,8 @@ const customModuleRegexes = bpkReactScriptsConfig.babelIncludePrefixes | |||
: []; | |||
|
|||
// Backpack node module regexes | |||
const scopedBackpackModulesRegex = /node_modules[\\/]@skyscanner[\\/]bpk-/; | |||
// const scopedBackpackModulesRegex = /node_modules[\\/]@skyscanner[\\/]bpk-/; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing this for an experiment. Will return later if fails
@@ -13,7 +13,7 @@ | |||
|
|||
module.exports = { | |||
process() { | |||
return 'module.exports = {};'; | |||
return { code: 'module.exports = {};' }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Jest syntax change
@@ -17,7 +17,8 @@ module.exports = { | |||
pascalCase: true, | |||
}); | |||
const componentName = `Svg${pascalCaseFilename}`; | |||
return `const React = require('react'); | |||
return { | |||
code: `const React = require('react'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Jest syntax change
@@ -26,13 +26,13 @@ | |||
}, | |||
"types": "./lib/react-app.d.ts", | |||
"dependencies": { | |||
"@babel/core": "^7.18.6", | |||
"@loadable/babel-plugin": "^5.13.2", | |||
"@babel/core": "^7.23.2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Explicitly bumping dependencies to latest version within the same major. Some of them contain fixes of known issues
"identity-obj-proxy": "^3.0.0", | ||
"jest": "^29.7.0", | ||
"jest-environment-jsdom": "^29.7.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs to be installed manually since Jest 28
"source-map-loader": "^3.0.0", | ||
"style-loader": "^3.3.1", | ||
"tailwindcss": "^3.0.2", | ||
"sass-loader": "^13.3.2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bumping major to support node-sass up to 9. None of breaking changes should affect us
@@ -92,7 +93,7 @@ | |||
"node-sass": ">=7", | |||
"react": ">= 17", | |||
"sass-embedded": "*", | |||
"typescript": "^3.2.1 || ^4 || ^5" | |||
"typescript": ">= 4.4.4" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drop support for old TypeScript versions
includePrefixes.unshift('bpk-'); | ||
includePrefixes.unshift('@skyscanner/bpk-'); | ||
includePrefixes.unshift('@skyscanner/backpack-web/bpk-mixins'); | ||
const includePrefixes = bpkReactScriptsConfig.jestIncludePrefixes || []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need a separate list for Jest as its module resolution mechanism is more strict compared to Webpack, but I still want to pass dependencies by their names instead of using bulk prefixes
@@ -51,6 +56,9 @@ module.exports = (resolve, rootDir, isEjecting) => { | |||
'<rootDir>/src/**/*.{spec,test}.{js,jsx,ts,tsx}', | |||
], | |||
testEnvironment: 'jsdom', | |||
testEnvironmentOptions: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Jest 28 changes
No description provided.