Skip to content

Commit 573c86e

Browse files
committed
Testing: Upgrade Jest to v27
1 parent 154918b commit 573c86e

File tree

37 files changed

+3128
-4842
lines changed

37 files changed

+3128
-4842
lines changed

package-lock.json

+2,925-4,381
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
"@babel/runtime-corejs3": "7.16.0",
9292
"@babel/traverse": "7.16.0",
9393
"@emotion/babel-plugin": "11.3.0",
94-
"@emotion/jest": "11.3.0",
94+
"@emotion/jest": "11.7.1",
9595
"@emotion/native": "^11.0.0",
9696
"@octokit/rest": "16.26.0",
9797
"@pmmmwh/react-refresh-webpack-plugin": "0.5.2",
@@ -105,7 +105,7 @@
105105
"@storybook/builder-webpack5": "6.4.9",
106106
"@storybook/manager-webpack5": "6.4.9",
107107
"@storybook/react": "6.4.9",
108-
"@testing-library/jest-dom": "5.11.9",
108+
"@testing-library/jest-dom": "5.16.1",
109109
"@testing-library/react": "11.2.2",
110110
"@testing-library/react-native": "7.1.0",
111111
"@types/classnames": "2.3.1",
@@ -148,7 +148,7 @@
148148
"ajv": "8.7.1",
149149
"ajv-draft-04": "1.0.0",
150150
"appium": "1.22.0",
151-
"babel-jest": "26.6.3",
151+
"babel-jest": "27.4.5",
152152
"babel-loader": "8.2.3",
153153
"babel-plugin-inline-json-import": "0.3.2",
154154
"babel-plugin-react-native-classname-to-style": "1.2.2",
@@ -175,11 +175,11 @@
175175
"glob": "7.1.2",
176176
"husky": "7.0.0",
177177
"inquirer": "7.1.0",
178-
"jest": "26.6.3",
179-
"jest-junit": "11.0.0",
180-
"jest-message-util": "27.0.6",
181-
"jest-watch-typeahead": "0.6.1",
182-
"jsdom": "16.4.0",
178+
"jest": "27.4.5",
179+
"jest-junit": "13.0.0",
180+
"jest-message-util": "27.4.2",
181+
"jest-watch-typeahead": "1.0.0",
182+
"jsdom": "16.7.0",
183183
"lerna": "3.22.1",
184184
"lint-staged": "9.2.5",
185185
"lodash": "4.17.21",

packages/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ _Example:_
9191
"check-node-version": "^4.1.0",
9292
"cross-spawn": "^5.1.0",
9393
"eslint": "^7.1.0",
94-
- "jest": "^26.6.3",
94+
- "jest": "^27.4.4",
9595
"minimist": "^1.2.0",
9696
"npm-package-json-lint": "^3.6.0",
9797
```

packages/block-editor/src/components/block-preview/test/index.js

+2
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ jest.mock( '@wordpress/dom', () => {
4747
};
4848
} );
4949

50+
jest.useRealTimers();
51+
5052
describe( 'useBlockPreview', () => {
5153
beforeAll( () => {
5254
registerBlockType( 'core/test-block', {

packages/block-editor/src/components/link-control/test/index.js

+2
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ jest.mock( '@wordpress/data/src/components/use-dispatch', () => ( {
5151
useDispatch: () => ( { saveEntityRecords: jest.fn() } ),
5252
} ) );
5353

54+
jest.useRealTimers();
55+
5456
/**
5557
* Wait for next tick of event loop. This is required
5658
* because the `fetchSearchSuggestions` Promise will

packages/block-editor/src/utils/test/parse-css-unit-to-px.js

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import {
66
getPxFromCssUnit,
77
} from '../parse-css-unit-to-px';
88

9+
jest.useRealTimers();
10+
911
describe( 'getPxFromCssUnit', () => {
1012
// Absolute units
1113
describe( 'absolute unites should return px values', () => {

packages/compose/src/hooks/use-disabled/test/index.js

+2
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ jest.mock( '@wordpress/dom', () => {
4343
};
4444
} );
4545

46+
jest.useRealTimers();
47+
4648
describe( 'useDisabled', () => {
4749
const Form = forwardRef( ( { showButton }, ref ) => {
4850
return (

packages/custom-templated-path-webpack-plugin/test/index.js

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ const accessAsync = promisify( access );
1818
const unlinkAsync = promisify( unlink );
1919
const webpackAsync = promisify( webpack );
2020

21+
jest.useRealTimers();
22+
2123
describe( 'CustomTemplatedPathPlugin', () => {
2224
const outputFile = path.join( __dirname, '/fixtures/build/entry-42.js' );
2325

packages/data/src/test/registry.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { createRegistrySelector } from '../factory';
1111
import createReduxStore from '../redux-store';
1212
import coreDataStore from '../store';
1313

14-
jest.useFakeTimers();
14+
jest.useFakeTimers( 'legacy' );
1515

1616
describe( 'createRegistry', () => {
1717
let registry;

packages/dependency-extraction-webpack-plugin/test/__snapshots__/build.js.snap

+27-27
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`Webpack \`combine-assets\` should produce expected output: Asset file 'assets.php' should match snapshot 1`] = `"<?php return array('fileA.js' => array('dependencies' => array('lodash', 'wp-blob'), 'version' => 'dd2fe63dd2d581e01ace6923ea5f1150'), 'fileB.js' => array('dependencies' => array('wp-token-list'), 'version' => '72d30a2459a6c29ccbc8bc4a8c6641b7'));"`;
3+
exports[`DependencyExtractionWebpackPlugin Webpack \`combine-assets\` should produce expected output: Asset file 'assets.php' should match snapshot 1`] = `"<?php return array('fileA.js' => array('dependencies' => array('lodash', 'wp-blob'), 'version' => 'dd2fe63dd2d581e01ace6923ea5f1150'), 'fileB.js' => array('dependencies' => array('wp-token-list'), 'version' => '72d30a2459a6c29ccbc8bc4a8c6641b7'));"`;
44

5-
exports[`Webpack \`combine-assets\` should produce expected output: External modules should match snapshot 1`] = `
5+
exports[`DependencyExtractionWebpackPlugin Webpack \`combine-assets\` should produce expected output: External modules should match snapshot 1`] = `
66
Array [
77
Object {
88
"externalType": "window",
@@ -28,9 +28,9 @@ Array [
2828
]
2929
`;
3030

31-
exports[`Webpack \`dynamic-import\` should produce expected output: Asset file 'main.asset.php' should match snapshot 1`] = `"<?php return array('dependencies' => array('lodash', 'wp-blob'), 'version' => '52a95452a51ae14be315bbac91fd66bf');"`;
31+
exports[`DependencyExtractionWebpackPlugin Webpack \`dynamic-import\` should produce expected output: Asset file 'main.asset.php' should match snapshot 1`] = `"<?php return array('dependencies' => array('lodash', 'wp-blob'), 'version' => '52a95452a51ae14be315bbac91fd66bf');"`;
3232

33-
exports[`Webpack \`dynamic-import\` should produce expected output: External modules should match snapshot 1`] = `
33+
exports[`DependencyExtractionWebpackPlugin Webpack \`dynamic-import\` should produce expected output: External modules should match snapshot 1`] = `
3434
Array [
3535
Object {
3636
"externalType": "window",
@@ -48,9 +48,9 @@ Array [
4848
]
4949
`;
5050

51-
exports[`Webpack \`function-output-filename\` should produce expected output: Asset file 'chunk--main--main.asset.php' should match snapshot 1`] = `"<?php return array('dependencies' => array('lodash', 'wp-blob'), 'version' => 'c44010df32f758565726bcefbf69a28b');"`;
51+
exports[`DependencyExtractionWebpackPlugin Webpack \`function-output-filename\` should produce expected output: Asset file 'chunk--main--main.asset.php' should match snapshot 1`] = `"<?php return array('dependencies' => array('lodash', 'wp-blob'), 'version' => 'c44010df32f758565726bcefbf69a28b');"`;
5252

53-
exports[`Webpack \`function-output-filename\` should produce expected output: External modules should match snapshot 1`] = `
53+
exports[`DependencyExtractionWebpackPlugin Webpack \`function-output-filename\` should produce expected output: External modules should match snapshot 1`] = `
5454
Array [
5555
Object {
5656
"externalType": "window",
@@ -68,9 +68,9 @@ Array [
6868
]
6969
`;
7070

71-
exports[`Webpack \`has-extension-suffix\` should produce expected output: Asset file 'index.min.asset.php' should match snapshot 1`] = `"<?php return array('dependencies' => array('lodash', 'wp-blob'), 'version' => '7e289f109b13dd69d9a1097f90bcfeb2');"`;
71+
exports[`DependencyExtractionWebpackPlugin Webpack \`has-extension-suffix\` should produce expected output: Asset file 'index.min.asset.php' should match snapshot 1`] = `"<?php return array('dependencies' => array('lodash', 'wp-blob'), 'version' => '7e289f109b13dd69d9a1097f90bcfeb2');"`;
7272

73-
exports[`Webpack \`has-extension-suffix\` should produce expected output: External modules should match snapshot 1`] = `
73+
exports[`DependencyExtractionWebpackPlugin Webpack \`has-extension-suffix\` should produce expected output: External modules should match snapshot 1`] = `
7474
Array [
7575
Object {
7676
"externalType": "window",
@@ -88,17 +88,17 @@ Array [
8888
]
8989
`;
9090

91-
exports[`Webpack \`no-default\` should produce expected output: Asset file 'main.asset.php' should match snapshot 1`] = `"<?php return array('dependencies' => array(), 'version' => '90ac5f67b465feaec264ee3047123919');"`;
91+
exports[`DependencyExtractionWebpackPlugin Webpack \`no-default\` should produce expected output: Asset file 'main.asset.php' should match snapshot 1`] = `"<?php return array('dependencies' => array(), 'version' => '90ac5f67b465feaec264ee3047123919');"`;
9292

93-
exports[`Webpack \`no-default\` should produce expected output: External modules should match snapshot 1`] = `Array []`;
93+
exports[`DependencyExtractionWebpackPlugin Webpack \`no-default\` should produce expected output: External modules should match snapshot 1`] = `Array []`;
9494

95-
exports[`Webpack \`no-deps\` should produce expected output: Asset file 'main.asset.php' should match snapshot 1`] = `"<?php return array('dependencies' => array(), 'version' => 'a7a065576c848d981b22daffdf0d336a');"`;
95+
exports[`DependencyExtractionWebpackPlugin Webpack \`no-deps\` should produce expected output: Asset file 'main.asset.php' should match snapshot 1`] = `"<?php return array('dependencies' => array(), 'version' => 'a7a065576c848d981b22daffdf0d336a');"`;
9696

97-
exports[`Webpack \`no-deps\` should produce expected output: External modules should match snapshot 1`] = `Array []`;
97+
exports[`DependencyExtractionWebpackPlugin Webpack \`no-deps\` should produce expected output: External modules should match snapshot 1`] = `Array []`;
9898

99-
exports[`Webpack \`option-function-output-filename\` should produce expected output: Asset file 'chunk--main--main.asset.php' should match snapshot 1`] = `"<?php return array('dependencies' => array('lodash', 'wp-blob'), 'version' => 'c44010df32f758565726bcefbf69a28b');"`;
99+
exports[`DependencyExtractionWebpackPlugin Webpack \`option-function-output-filename\` should produce expected output: Asset file 'chunk--main--main.asset.php' should match snapshot 1`] = `"<?php return array('dependencies' => array('lodash', 'wp-blob'), 'version' => 'c44010df32f758565726bcefbf69a28b');"`;
100100

101-
exports[`Webpack \`option-function-output-filename\` should produce expected output: External modules should match snapshot 1`] = `
101+
exports[`DependencyExtractionWebpackPlugin Webpack \`option-function-output-filename\` should produce expected output: External modules should match snapshot 1`] = `
102102
Array [
103103
Object {
104104
"externalType": "window",
@@ -116,9 +116,9 @@ Array [
116116
]
117117
`;
118118

119-
exports[`Webpack \`option-output-filename\` should produce expected output: Asset file 'main-foo.asset.php' should match snapshot 1`] = `"<?php return array('dependencies' => array('lodash', 'wp-blob'), 'version' => 'c44010df32f758565726bcefbf69a28b');"`;
119+
exports[`DependencyExtractionWebpackPlugin Webpack \`option-output-filename\` should produce expected output: Asset file 'main-foo.asset.php' should match snapshot 1`] = `"<?php return array('dependencies' => array('lodash', 'wp-blob'), 'version' => 'c44010df32f758565726bcefbf69a28b');"`;
120120

121-
exports[`Webpack \`option-output-filename\` should produce expected output: External modules should match snapshot 1`] = `
121+
exports[`DependencyExtractionWebpackPlugin Webpack \`option-output-filename\` should produce expected output: External modules should match snapshot 1`] = `
122122
Array [
123123
Object {
124124
"externalType": "window",
@@ -136,9 +136,9 @@ Array [
136136
]
137137
`;
138138

139-
exports[`Webpack \`output-format-json\` should produce expected output: Asset file 'main.asset.json' should match snapshot 1`] = `"{\\"dependencies\\":[\\"lodash\\"],\\"version\\":\\"ff689135319685f74bf813654f70c5a4\\"}"`;
139+
exports[`DependencyExtractionWebpackPlugin Webpack \`output-format-json\` should produce expected output: Asset file 'main.asset.json' should match snapshot 1`] = `"{\\"dependencies\\":[\\"lodash\\"],\\"version\\":\\"ff689135319685f74bf813654f70c5a4\\"}"`;
140140

141-
exports[`Webpack \`output-format-json\` should produce expected output: External modules should match snapshot 1`] = `
141+
exports[`DependencyExtractionWebpackPlugin Webpack \`output-format-json\` should produce expected output: External modules should match snapshot 1`] = `
142142
Array [
143143
Object {
144144
"externalType": "window",
@@ -148,9 +148,9 @@ Array [
148148
]
149149
`;
150150

151-
exports[`Webpack \`overrides\` should produce expected output: Asset file 'main.asset.php' should match snapshot 1`] = `"<?php return array('dependencies' => array('wp-blob', 'wp-script-handle-for-rxjs', 'wp-url'), 'version' => '97c94d19d2d93c0ef60f14d590cf1204');"`;
151+
exports[`DependencyExtractionWebpackPlugin Webpack \`overrides\` should produce expected output: Asset file 'main.asset.php' should match snapshot 1`] = `"<?php return array('dependencies' => array('wp-blob', 'wp-script-handle-for-rxjs', 'wp-url'), 'version' => '97c94d19d2d93c0ef60f14d590cf1204');"`;
152152

153-
exports[`Webpack \`overrides\` should produce expected output: External modules should match snapshot 1`] = `
153+
exports[`DependencyExtractionWebpackPlugin Webpack \`overrides\` should produce expected output: External modules should match snapshot 1`] = `
154154
Array [
155155
Object {
156156
"externalType": "window",
@@ -184,11 +184,11 @@ Array [
184184
]
185185
`;
186186

187-
exports[`Webpack \`runtime-chunk-single\` should produce expected output: Asset file 'a.asset.php' should match snapshot 1`] = `"<?php return array('dependencies' => array('wp-blob'), 'version' => 'd189640bf0bd44c2f6f9fee71b00d756');"`;
187+
exports[`DependencyExtractionWebpackPlugin Webpack \`runtime-chunk-single\` should produce expected output: Asset file 'a.asset.php' should match snapshot 1`] = `"<?php return array('dependencies' => array('wp-blob'), 'version' => 'd189640bf0bd44c2f6f9fee71b00d756');"`;
188188

189-
exports[`Webpack \`runtime-chunk-single\` should produce expected output: Asset file 'b.asset.php' should match snapshot 1`] = `"<?php return array('dependencies' => array('lodash', 'wp-blob'), 'version' => 'dd30d1b96694d89afddbfad01a09ee4d');"`;
189+
exports[`DependencyExtractionWebpackPlugin Webpack \`runtime-chunk-single\` should produce expected output: Asset file 'b.asset.php' should match snapshot 1`] = `"<?php return array('dependencies' => array('lodash', 'wp-blob'), 'version' => 'dd30d1b96694d89afddbfad01a09ee4d');"`;
190190

191-
exports[`Webpack \`runtime-chunk-single\` should produce expected output: External modules should match snapshot 1`] = `
191+
exports[`DependencyExtractionWebpackPlugin Webpack \`runtime-chunk-single\` should produce expected output: External modules should match snapshot 1`] = `
192192
Array [
193193
Object {
194194
"externalType": "window",
@@ -206,9 +206,9 @@ Array [
206206
]
207207
`;
208208

209-
exports[`Webpack \`wordpress\` should produce expected output: Asset file 'main.asset.php' should match snapshot 1`] = `"<?php return array('dependencies' => array('lodash', 'wp-blob'), 'version' => 'c44010df32f758565726bcefbf69a28b');"`;
209+
exports[`DependencyExtractionWebpackPlugin Webpack \`wordpress\` should produce expected output: Asset file 'main.asset.php' should match snapshot 1`] = `"<?php return array('dependencies' => array('lodash', 'wp-blob'), 'version' => 'c44010df32f758565726bcefbf69a28b');"`;
210210

211-
exports[`Webpack \`wordpress\` should produce expected output: External modules should match snapshot 1`] = `
211+
exports[`DependencyExtractionWebpackPlugin Webpack \`wordpress\` should produce expected output: External modules should match snapshot 1`] = `
212212
Array [
213213
Object {
214214
"externalType": "window",
@@ -226,9 +226,9 @@ Array [
226226
]
227227
`;
228228

229-
exports[`Webpack \`wordpress-require\` should produce expected output: Asset file 'main.asset.php' should match snapshot 1`] = `"<?php return array('dependencies' => array('lodash', 'wp-blob'), 'version' => '4f30547fb762285f57176ff70a968bbc');"`;
229+
exports[`DependencyExtractionWebpackPlugin Webpack \`wordpress-require\` should produce expected output: Asset file 'main.asset.php' should match snapshot 1`] = `"<?php return array('dependencies' => array('lodash', 'wp-blob'), 'version' => '4f30547fb762285f57176ff70a968bbc');"`;
230230

231-
exports[`Webpack \`wordpress-require\` should produce expected output: External modules should match snapshot 1`] = `
231+
exports[`DependencyExtractionWebpackPlugin Webpack \`wordpress-require\` should produce expected output: External modules should match snapshot 1`] = `
232232
Array [
233233
Object {
234234
"externalType": "window",

0 commit comments

Comments
 (0)