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

[ARGG-773]: Changes to support testing with Jest 29 #176

Merged
merged 1 commit into from
Nov 8, 2023

Conversation

xalechez
Copy link

@xalechez xalechez commented Nov 8, 2023

No description provided.

@@ -21,8 +21,8 @@ const customModuleRegexes = bpkReactScriptsConfig.babelIncludePrefixes
: [];

// Backpack node module regexes
const scopedBackpackModulesRegex = /node_modules[\\/]@skyscanner[\\/]bpk-/;
// const scopedBackpackModulesRegex = /node_modules[\\/]@skyscanner[\\/]bpk-/;
Copy link
Author

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 = {};' };
Copy link
Author

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');
Copy link
Author

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",
Copy link
Author

@xalechez xalechez Nov 8, 2023

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",
Copy link
Author

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",
Copy link
Author

@xalechez xalechez Nov 8, 2023

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"
Copy link
Author

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 || [];
Copy link
Author

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: {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jest 28 changes

@xalechez xalechez merged commit 1b40bff into fork_cra5 Nov 8, 2023
2 checks passed
@xalechez xalechez deleted the ARGG-773-testing branch November 30, 2023 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants