Skip to content

Commit

Permalink
Testing: Upgrade Jest to v27
Browse files Browse the repository at this point in the history
  • Loading branch information
gziolo committed Jan 12, 2022
1 parent c6ca200 commit f80fa82
Show file tree
Hide file tree
Showing 37 changed files with 3,135 additions and 4,866 deletions.
7,337 changes: 2,932 additions & 4,405 deletions package-lock.json

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
"@babel/runtime-corejs3": "7.16.0",
"@babel/traverse": "7.16.0",
"@emotion/babel-plugin": "11.3.0",
"@emotion/jest": "11.3.0",
"@emotion/jest": "11.7.1",
"@emotion/native": "^11.0.0",
"@octokit/rest": "16.26.0",
"@pmmmwh/react-refresh-webpack-plugin": "0.5.2",
Expand All @@ -105,7 +105,7 @@
"@storybook/builder-webpack5": "6.4.9",
"@storybook/manager-webpack5": "6.4.9",
"@storybook/react": "6.4.9",
"@testing-library/jest-dom": "5.11.9",
"@testing-library/jest-dom": "5.16.1",
"@testing-library/react": "11.2.2",
"@testing-library/react-native": "7.1.0",
"@types/classnames": "2.3.1",
Expand Down Expand Up @@ -148,7 +148,7 @@
"ajv": "8.7.1",
"ajv-draft-04": "1.0.0",
"appium": "1.22.0",
"babel-jest": "26.6.3",
"babel-jest": "27.4.5",
"babel-loader": "8.2.3",
"babel-plugin-inline-json-import": "0.3.2",
"babel-plugin-react-native-classname-to-style": "1.2.2",
Expand All @@ -175,11 +175,11 @@
"glob": "7.1.2",
"husky": "7.0.0",
"inquirer": "7.1.0",
"jest": "26.6.3",
"jest-junit": "11.0.0",
"jest-message-util": "27.0.6",
"jest-watch-typeahead": "0.6.1",
"jsdom": "16.4.0",
"jest": "27.4.5",
"jest-junit": "13.0.0",
"jest-message-util": "27.4.2",
"jest-watch-typeahead": "1.0.0",
"jsdom": "16.7.0",
"lerna": "3.22.1",
"lint-staged": "9.2.5",
"lodash": "4.17.21",
Expand Down
2 changes: 1 addition & 1 deletion packages/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ _Example:_
"check-node-version": "^4.1.0",
"cross-spawn": "^5.1.0",
"eslint": "^7.1.0",
- "jest": "^26.6.3",
- "jest": "^27.4.4",
"minimist": "^1.2.0",
"npm-package-json-lint": "^3.6.0",
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ jest.mock( '@wordpress/dom', () => {
};
} );

jest.useRealTimers();

describe( 'useBlockPreview', () => {
beforeAll( () => {
registerBlockType( 'core/test-block', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ jest.mock( '@wordpress/data/src/components/use-dispatch', () => ( {
useDispatch: () => ( { saveEntityRecords: jest.fn() } ),
} ) );

jest.useRealTimers();

/**
* Wait for next tick of event loop. This is required
* because the `fetchSearchSuggestions` Promise will
Expand Down
2 changes: 2 additions & 0 deletions packages/block-editor/src/utils/test/parse-css-unit-to-px.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import {
getPxFromCssUnit,
} from '../parse-css-unit-to-px';

jest.useRealTimers();

describe( 'getPxFromCssUnit', () => {
// Absolute units
describe( 'absolute unites should return px values', () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/compose/src/hooks/use-disabled/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ jest.mock( '@wordpress/dom', () => {
};
} );

jest.useRealTimers();

describe( 'useDisabled', () => {
const Form = forwardRef( ( { showButton }, ref ) => {
return (
Expand Down
2 changes: 2 additions & 0 deletions packages/custom-templated-path-webpack-plugin/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ const accessAsync = promisify( access );
const unlinkAsync = promisify( unlink );
const webpackAsync = promisify( webpack );

jest.useRealTimers();

describe( 'CustomTemplatedPathPlugin', () => {
const outputFile = path.join( __dirname, '/fixtures/build/entry-42.js' );

Expand Down
2 changes: 1 addition & 1 deletion packages/data/src/test/registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { createRegistrySelector } from '../factory';
import createReduxStore from '../redux-store';
import coreDataStore from '../store';

jest.useFakeTimers();
jest.useFakeTimers( 'legacy' );

describe( 'createRegistry', () => {
let registry;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

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'));"`;
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'));"`;

exports[`Webpack \`combine-assets\` should produce expected output: External modules should match snapshot 1`] = `
exports[`DependencyExtractionWebpackPlugin Webpack \`combine-assets\` should produce expected output: External modules should match snapshot 1`] = `
Array [
Object {
"externalType": "window",
Expand All @@ -28,9 +28,9 @@ Array [
]
`;

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');"`;
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');"`;

exports[`Webpack \`dynamic-import\` should produce expected output: External modules should match snapshot 1`] = `
exports[`DependencyExtractionWebpackPlugin Webpack \`dynamic-import\` should produce expected output: External modules should match snapshot 1`] = `
Array [
Object {
"externalType": "window",
Expand All @@ -48,9 +48,9 @@ Array [
]
`;

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');"`;
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');"`;

exports[`Webpack \`function-output-filename\` should produce expected output: External modules should match snapshot 1`] = `
exports[`DependencyExtractionWebpackPlugin Webpack \`function-output-filename\` should produce expected output: External modules should match snapshot 1`] = `
Array [
Object {
"externalType": "window",
Expand All @@ -68,9 +68,9 @@ Array [
]
`;

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');"`;
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');"`;

exports[`Webpack \`has-extension-suffix\` should produce expected output: External modules should match snapshot 1`] = `
exports[`DependencyExtractionWebpackPlugin Webpack \`has-extension-suffix\` should produce expected output: External modules should match snapshot 1`] = `
Array [
Object {
"externalType": "window",
Expand All @@ -88,17 +88,17 @@ Array [
]
`;

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

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

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

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

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');"`;
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');"`;

exports[`Webpack \`option-function-output-filename\` should produce expected output: External modules should match snapshot 1`] = `
exports[`DependencyExtractionWebpackPlugin Webpack \`option-function-output-filename\` should produce expected output: External modules should match snapshot 1`] = `
Array [
Object {
"externalType": "window",
Expand All @@ -116,9 +116,9 @@ Array [
]
`;

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');"`;
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');"`;

exports[`Webpack \`option-output-filename\` should produce expected output: External modules should match snapshot 1`] = `
exports[`DependencyExtractionWebpackPlugin Webpack \`option-output-filename\` should produce expected output: External modules should match snapshot 1`] = `
Array [
Object {
"externalType": "window",
Expand All @@ -136,9 +136,9 @@ Array [
]
`;

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

exports[`Webpack \`output-format-json\` should produce expected output: External modules should match snapshot 1`] = `
exports[`DependencyExtractionWebpackPlugin Webpack \`output-format-json\` should produce expected output: External modules should match snapshot 1`] = `
Array [
Object {
"externalType": "window",
Expand All @@ -148,9 +148,9 @@ Array [
]
`;

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');"`;
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');"`;

exports[`Webpack \`overrides\` should produce expected output: External modules should match snapshot 1`] = `
exports[`DependencyExtractionWebpackPlugin Webpack \`overrides\` should produce expected output: External modules should match snapshot 1`] = `
Array [
Object {
"externalType": "window",
Expand Down Expand Up @@ -184,11 +184,11 @@ Array [
]
`;

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');"`;
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');"`;

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');"`;
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');"`;

exports[`Webpack \`runtime-chunk-single\` should produce expected output: External modules should match snapshot 1`] = `
exports[`DependencyExtractionWebpackPlugin Webpack \`runtime-chunk-single\` should produce expected output: External modules should match snapshot 1`] = `
Array [
Object {
"externalType": "window",
Expand All @@ -206,9 +206,9 @@ Array [
]
`;

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');"`;
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');"`;

exports[`Webpack \`wordpress\` should produce expected output: External modules should match snapshot 1`] = `
exports[`DependencyExtractionWebpackPlugin Webpack \`wordpress\` should produce expected output: External modules should match snapshot 1`] = `
Array [
Object {
"externalType": "window",
Expand All @@ -226,9 +226,9 @@ Array [
]
`;

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');"`;
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');"`;

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

0 comments on commit f80fa82

Please sign in to comment.