@commercetools-frontend/jest-preset-mc-app 21.25.2 → 22.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +48 -0
- package/jest-preset.js +9 -2
- package/module-exports-resolver.js +24 -0
- package/package.json +17 -12
- package/transform-babel-jest.js +1 -14
- package/transform-graphql.js +7 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,53 @@
|
|
|
1
1
|
# @commercetools-frontend/jest-preset-mc-app
|
|
2
2
|
|
|
3
|
+
## 22.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies []:
|
|
8
|
+
- @commercetools-frontend/babel-preset-mc-app@22.0.1
|
|
9
|
+
|
|
10
|
+
## 22.0.0
|
|
11
|
+
|
|
12
|
+
### Major Changes
|
|
13
|
+
|
|
14
|
+
- [#3026](https://github.com/commercetools/merchant-center-application-kit/pull/3026) [`968c3c4d2`](https://github.com/commercetools/merchant-center-application-kit/commit/968c3c4d21e0caeb98334f5d905213dbdd9b208d) Thanks [@emmenko](https://github.com/emmenko)! - Upgrade following dependencies to major versions:
|
|
15
|
+
|
|
16
|
+
- `jest` to `v29.x`.
|
|
17
|
+
- `jsdom` to `v21.x`.
|
|
18
|
+
- `eslint-plugin-jest` to `v27.x`.
|
|
19
|
+
|
|
20
|
+
# Migration
|
|
21
|
+
|
|
22
|
+
The package `@commercetools-frontend/jest-preset-mc-app` contains most of the updates and migration changes.
|
|
23
|
+
|
|
24
|
+
We don't expect any specific migration effort besides updating all Jest dependencies to their latest version (including possible Jest plugins being used).
|
|
25
|
+
|
|
26
|
+
However, there are a couple of possible necessary updates to consider:
|
|
27
|
+
|
|
28
|
+
- [Jest snapshots format changed a bit](https://jestjs.io/docs/upgrading-to-jest29#snapshot-format). You might need to update your snapshots by passing the option `-u` to the Jest command.
|
|
29
|
+
- The ESLint plugin for Jest might yield some new errors due to its breaking changes. See [changelog](https://github.com/jest-community/eslint-plugin-jest/blob/main/CHANGELOG.md#2700-2022-08-28).
|
|
30
|
+
|
|
31
|
+
For more detailed information about upgrading Jest, please refer to the official guides:
|
|
32
|
+
|
|
33
|
+
- [From v27 to v28](https://jestjs.io/docs/28.x/upgrading-to-jest28)
|
|
34
|
+
- [From v28 to v29](https://jestjs.io/docs/upgrading-to-jest29)
|
|
35
|
+
|
|
36
|
+
- [#3029](https://github.com/commercetools/merchant-center-application-kit/pull/3029) [`2426a3849`](https://github.com/commercetools/merchant-center-application-kit/commit/2426a3849ac9f3e581e0d3e06df672391c5ce56e) Thanks [@emmenko](https://github.com/emmenko)! - Upgrade `react-intl` to `v6`.
|
|
37
|
+
|
|
38
|
+
# Migration
|
|
39
|
+
|
|
40
|
+
The peer dependency of `react-intl` should be updated to `v6`. No other migration steps are required.
|
|
41
|
+
|
|
42
|
+
### Minor Changes
|
|
43
|
+
|
|
44
|
+
- [#3029](https://github.com/commercetools/merchant-center-application-kit/pull/3029) [`2426a3849`](https://github.com/commercetools/merchant-center-application-kit/commit/2426a3849ac9f3e581e0d3e06df672391c5ce56e) Thanks [@emmenko](https://github.com/emmenko)! - Update UI Kit dependencies to v16
|
|
45
|
+
|
|
46
|
+
### Patch Changes
|
|
47
|
+
|
|
48
|
+
- Updated dependencies [[`76ba54c16`](https://github.com/commercetools/merchant-center-application-kit/commit/76ba54c164dbac75ef3e3962292933b06f4843e7)]:
|
|
49
|
+
- @commercetools-frontend/babel-preset-mc-app@22.0.0
|
|
50
|
+
|
|
3
51
|
## 21.25.2
|
|
4
52
|
|
|
5
53
|
### Patch Changes
|
package/jest-preset.js
CHANGED
|
@@ -13,6 +13,10 @@ const defaultSetupTestFramework = resolveRelativePath(
|
|
|
13
13
|
const defaultTransformBabelJest = resolveRelativePath(
|
|
14
14
|
'./transform-babel-jest.js'
|
|
15
15
|
);
|
|
16
|
+
const defaultTransformGraphQL = resolveRelativePath('./transform-graphql.js');
|
|
17
|
+
const defaultModuleExportsResolver = resolveRelativePath(
|
|
18
|
+
'./module-exports-resolver.js'
|
|
19
|
+
);
|
|
16
20
|
|
|
17
21
|
module.exports = {
|
|
18
22
|
displayName: 'test',
|
|
@@ -28,16 +32,19 @@ module.exports = {
|
|
|
28
32
|
defaultTransformFile,
|
|
29
33
|
'\\.css$': 'identity-obj-proxy',
|
|
30
34
|
},
|
|
35
|
+
resolver: defaultModuleExportsResolver,
|
|
31
36
|
rootDir: rootPath,
|
|
32
37
|
setupFiles: ['raf/polyfill', defaultSetupTests, 'jest-localstorage-mock'],
|
|
33
38
|
setupFilesAfterEnv: [defaultSetupTestFramework],
|
|
34
39
|
testEnvironment: 'jsdom',
|
|
35
|
-
|
|
40
|
+
testEnvironmentOptions: {
|
|
41
|
+
url: 'https://mc.europe-west1.gcp.commercetools.com/',
|
|
42
|
+
},
|
|
36
43
|
testPathIgnorePatterns: ['node_modules', 'cypress'],
|
|
37
44
|
testRegex: '\\.spec\\.jsx?$',
|
|
38
45
|
transform: {
|
|
39
46
|
'^.+\\.(js|jsx|mjs|ts|tsx)$': defaultTransformBabelJest,
|
|
40
|
-
'^.+\\.graphql$':
|
|
47
|
+
'^.+\\.graphql$': defaultTransformGraphQL,
|
|
41
48
|
},
|
|
42
49
|
watchPlugins: ['jest-watch-typeahead/filename'],
|
|
43
50
|
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const modulesWithFaultyExports = [
|
|
2
|
+
'@react-hook/resize-observer',
|
|
3
|
+
'@react-hook/passive-layout-effect',
|
|
4
|
+
'@react-hook/latest',
|
|
5
|
+
];
|
|
6
|
+
|
|
7
|
+
// https://jestjs.io/docs/configuration#resolver-string
|
|
8
|
+
module.exports = (path, options) => {
|
|
9
|
+
// Call the defaultResolver, so we leverage its cache, error handling, etc.
|
|
10
|
+
return options.defaultResolver(path, {
|
|
11
|
+
...options,
|
|
12
|
+
// Use packageFilter to process parsed `package.json` before the resolution (see https://www.npmjs.com/package/resolve#resolveid-opts-cb)
|
|
13
|
+
// NOTE: this is a workaround to fix the lack of ESM support from Jest.
|
|
14
|
+
// See https://github.com/react-hook-form/resolvers/issues/396#issuecomment-1114248072
|
|
15
|
+
// TL;DR: we ensure that the faulty packages use the CJS entry point instead of the ESM one.
|
|
16
|
+
packageFilter: (pkg) => {
|
|
17
|
+
if (modulesWithFaultyExports.includes(pkg.name)) {
|
|
18
|
+
delete pkg['exports'];
|
|
19
|
+
delete pkg['module'];
|
|
20
|
+
}
|
|
21
|
+
return pkg;
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools-frontend/jest-preset-mc-app",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "22.0.1",
|
|
4
4
|
"description": "Jest preset used by a MC application",
|
|
5
5
|
"bugs": "https://github.com/commercetools/merchant-center-application-kit/issues",
|
|
6
6
|
"repository": {
|
|
@@ -17,30 +17,35 @@
|
|
|
17
17
|
"main": "./jest-preset.js",
|
|
18
18
|
"module": "./jest-preset.js",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@commercetools-frontend/babel-preset-mc-app": "
|
|
21
|
-
"@formatjs/intl-getcanonicallocales": "^1.
|
|
22
|
-
"@formatjs/intl-listformat": "^7.1.
|
|
23
|
-
"@formatjs/intl-locale": "^
|
|
24
|
-
"@formatjs/intl-numberformat": "^
|
|
25
|
-
"@formatjs/intl-pluralrules": "^
|
|
20
|
+
"@commercetools-frontend/babel-preset-mc-app": "22.0.1",
|
|
21
|
+
"@formatjs/intl-getcanonicallocales": "^2.1.0",
|
|
22
|
+
"@formatjs/intl-listformat": "^7.1.9",
|
|
23
|
+
"@formatjs/intl-locale": "^3.1.1",
|
|
24
|
+
"@formatjs/intl-numberformat": "^8.3.5",
|
|
25
|
+
"@formatjs/intl-pluralrules": "^5.1.10",
|
|
26
26
|
"@sheerun/mutationobserver-shim": "0.3.3",
|
|
27
27
|
"@testing-library/jest-dom": "5.16.5",
|
|
28
|
-
"babel-jest": "
|
|
28
|
+
"babel-jest": "29.5.0",
|
|
29
|
+
"babel-preset-jest": "29.5.0",
|
|
29
30
|
"colors": "1.4.0",
|
|
30
31
|
"cosmiconfig": "7.1.0",
|
|
32
|
+
"graphql-tag": "^2.12.6",
|
|
31
33
|
"identity-obj-proxy": "3.0.0",
|
|
32
34
|
"intl": "1.2.5",
|
|
35
|
+
"jest-environment-jsdom": "^29.5.0",
|
|
33
36
|
"jest-localstorage-mock": "2.4.26",
|
|
34
|
-
"jest-mock": "^
|
|
37
|
+
"jest-mock": "^29.5.0",
|
|
35
38
|
"jest-silent-reporter": "0.5.0",
|
|
36
|
-
"jest-
|
|
37
|
-
"jest-watch-typeahead": "1.1.0",
|
|
39
|
+
"jest-watch-typeahead": "2.2.2",
|
|
38
40
|
"raf": "3.4.1",
|
|
39
41
|
"setimmediate": "1.0.5",
|
|
40
42
|
"unfetch": "4.2.0"
|
|
41
43
|
},
|
|
42
44
|
"devDependencies": {
|
|
43
45
|
"@testing-library/react": "12.1.5",
|
|
44
|
-
"jest": "
|
|
46
|
+
"jest": "29.5.0"
|
|
47
|
+
},
|
|
48
|
+
"peerDependencies": {
|
|
49
|
+
"jest": "29.x"
|
|
45
50
|
}
|
|
46
51
|
}
|
package/transform-babel-jest.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const { createTransformer } = require('babel-jest');
|
|
2
2
|
const getJestBabelPreset = require('babel-preset-jest');
|
|
3
3
|
const getBabePresetConfigForMcApp = require('@commercetools-frontend/babel-preset-mc-app');
|
|
4
4
|
const hasJsxRuntime = require('./has-jsx-runtime');
|
|
@@ -18,19 +18,6 @@ const jestBabelConfig = {
|
|
|
18
18
|
plugins: [...mcAppBabelConfig.plugins, ...getJestBabelPreset().plugins],
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
-
/**
|
|
22
|
-
* NOTE:
|
|
23
|
-
* In `babel-jest` v27 the export has changed
|
|
24
|
-
* from: `babelJest.createTransformer`
|
|
25
|
-
* to `babelJest.default.createTransformer`.
|
|
26
|
-
* In order to remain backwards compatible the
|
|
27
|
-
* type of the export is checked.
|
|
28
|
-
*/
|
|
29
|
-
const createTransformer =
|
|
30
|
-
typeof babelJest.createTransformer === 'function'
|
|
31
|
-
? babelJest.createTransformer
|
|
32
|
-
: babelJest.default.createTransformer;
|
|
33
|
-
|
|
34
21
|
const transformer = createTransformer(jestBabelConfig);
|
|
35
22
|
|
|
36
23
|
module.exports = transformer;
|