@ornikar/jest-config-react 11.1.1 → 11.2.0
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 +9 -0
- package/jest-preset.js +4 -0
- package/package.json +5 -4
- package/test-setup-after-env.js +38 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,15 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [11.2.0](https://github.com/ornikar/shared-configs/compare/@ornikar/jest-config-react@11.1.1...@ornikar/jest-config-react@11.2.0) (2023-08-01)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* add jest-fail-on-console setup on jest-config-react [no issue] ([#947](https://github.com/ornikar/shared-configs/issues/947)) ([1072200](https://github.com/ornikar/shared-configs/commit/1072200e2eb87d37796795582ee4e3f97eaa5e22))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
6
15
|
## [11.1.1](https://github.com/ornikar/shared-configs/compare/@ornikar/jest-config-react@11.1.0...@ornikar/jest-config-react@11.1.1) (2023-07-26)
|
|
7
16
|
|
|
8
17
|
**Note:** Version bump only for package @ornikar/jest-config-react
|
package/jest-preset.js
CHANGED
|
@@ -24,6 +24,10 @@ module.exports = {
|
|
|
24
24
|
require.resolve('./test-setup'),
|
|
25
25
|
baseJestPreset.setupFiles.at(-1),
|
|
26
26
|
],
|
|
27
|
+
setupFilesAfterEnv: [
|
|
28
|
+
// overrides test-setup-after-env from base config.
|
|
29
|
+
require.resolve('./test-setup-after-env'),
|
|
30
|
+
],
|
|
27
31
|
transform: {
|
|
28
32
|
'\\.raw\\.svg$': require.resolve('./transformers/asset-name-transformer'),
|
|
29
33
|
// legacy support, use { ReactComponent } from .svg instead.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ornikar/jest-config-react",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.2.0",
|
|
4
4
|
"description": "✅⚛️ jest config for react",
|
|
5
5
|
"repository": {
|
|
6
6
|
"directory": "@ornikar/jest-config-react",
|
|
@@ -23,8 +23,9 @@
|
|
|
23
23
|
"react-dom": "^18.2.0"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@ornikar/jest-config": "9.
|
|
27
|
-
"identity-obj-proxy": "^3.0.0"
|
|
26
|
+
"@ornikar/jest-config": "9.6.0",
|
|
27
|
+
"identity-obj-proxy": "^3.0.0",
|
|
28
|
+
"jest-fail-on-console": "^3.1.1"
|
|
28
29
|
},
|
|
29
30
|
"devDependencies": {
|
|
30
31
|
"@testing-library/react": "14.0.0",
|
|
@@ -35,5 +36,5 @@
|
|
|
35
36
|
"scripts": {
|
|
36
37
|
"lint:eslint": "yarn ../.. eslint --report-unused-disable-directives --quiet @ornikar/jest-config-react"
|
|
37
38
|
},
|
|
38
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "01764f2390821f7c2f47ebbe61ec5d51b978b310"
|
|
39
40
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/* eslint-env jest */
|
|
2
|
+
|
|
3
|
+
'use strict';
|
|
4
|
+
|
|
5
|
+
const failOnConsole = require('jest-fail-on-console');
|
|
6
|
+
|
|
7
|
+
const deprecatedReactLifeCycleMethods = [
|
|
8
|
+
'componentWillMount',
|
|
9
|
+
'componentWillUnmount',
|
|
10
|
+
'componentWillUpdate',
|
|
11
|
+
'componentWillReceiveProps',
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
failOnConsole({
|
|
15
|
+
silenceMessage: (message) => {
|
|
16
|
+
// setNativeProps is used by @react-spring, so we can't do anything about it
|
|
17
|
+
if (message.includes('setNativeProps is deprecated. Please update props using React state instead.')) {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Do not ignore the act / await warning anymore once we are on React 18
|
|
22
|
+
if (message.includes('You called act(async () => ...) without await')) return true;
|
|
23
|
+
|
|
24
|
+
// Warning from @react-aria/ssr
|
|
25
|
+
if (message.startsWith('In React 18, SSRProvider is not necessary')) return true;
|
|
26
|
+
|
|
27
|
+
// Deprecated lifecycle methods are forbidden in our eslint config. This means any related warning is due to a dependency and can be ignored in tests.
|
|
28
|
+
if (
|
|
29
|
+
deprecatedReactLifeCycleMethods.some((lifecycleMethod) =>
|
|
30
|
+
message.includes(`${lifecycleMethod} has been renamed, and is not recommended for use.`),
|
|
31
|
+
)
|
|
32
|
+
) {
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return false;
|
|
37
|
+
},
|
|
38
|
+
});
|