Skip to content

Commit

Permalink
Revert "Upgrade Jest from 27 to 29.5.0 (#47388)"
Browse files Browse the repository at this point in the history
This reverts commit 163b7f6.
  • Loading branch information
dcalhoun committed Mar 8, 2023
1 parent c5d3aec commit 2fbd522
Show file tree
Hide file tree
Showing 34 changed files with 32,446 additions and 29,246 deletions.
61,505 changes: 32,382 additions & 29,123 deletions package-lock.json

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions package.json
Expand Up @@ -160,7 +160,7 @@
"ajv": "8.7.1",
"ajv-draft-04": "1.0.0",
"appium": "1.22.3",
"babel-jest": "29.5.0",
"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 Down Expand Up @@ -194,11 +194,11 @@
"glob": "7.1.2",
"husky": "7.0.0",
"inquirer": "7.1.0",
"jest": "29.5.0",
"jest-jasmine2": "29.5.0",
"jest": "27.4.5",
"jest-junit": "13.0.0",
"jest-message-util": "29.5.0",
"jest-watch-typeahead": "2.2.2",
"jest-message-util": "27.4.2",
"jest-watch-typeahead": "1.0.0",
"jsdom": "16.7.0",
"lerna": "5.5.2",
"lint-staged": "10.0.1",
"lodash": "4.17.21",
Expand Down Expand Up @@ -229,7 +229,7 @@
"sass-loader": "12.1.0",
"semver": "7.3.5",
"simple-git": "3.5.0",
"snapshot-diff": "0.10.0",
"snapshot-diff": "0.8.1",
"source-map-loader": "3.0.0",
"sprintf-js": "1.1.1",
"storybook-source-link": "2.0.4",
Expand Down
2 changes: 1 addition & 1 deletion packages/README.md
Expand Up @@ -92,7 +92,7 @@ _Example:_
"check-node-version": "^4.1.0",
"cross-spawn": "^5.1.0",
"eslint": "^7.1.0",
- "jest": "^29.5.0",
- "jest": "^27.4.4",
"minimist": "^1.2.0",
"npm-package-json-lint": "^3.6.0",
```
Expand Down
Expand Up @@ -28,7 +28,7 @@ const TestScreen = ( { fullScreen, name, navigateTo } ) => {
};

beforeAll( () => {
jest.useFakeTimers( { legacyFakeTimers: true } );
jest.useFakeTimers( 'legacy' );
} );

afterAll( () => {
Expand Down
Expand Up @@ -10,7 +10,7 @@ import { render, fireEvent, waitFor } from 'test/helpers';
import LinkSettingsNavigation from '../link-settings-navigation';

beforeAll( () => {
jest.useFakeTimers( { legacyFakeTimers: true } );
jest.useFakeTimers( 'legacy' );
} );

afterAll( () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/data/src/test/privateAPIs.js
Expand Up @@ -10,7 +10,7 @@ import { unlock } from '../private-apis';
*/

beforeEach( () => {
jest.useFakeTimers( { legacyFakeTimers: true } );
jest.useFakeTimers( 'legacy' );
} );

afterEach( () => {
Expand Down
9 changes: 8 additions & 1 deletion packages/data/src/test/registry.js
Expand Up @@ -8,7 +8,14 @@ import { createRegistrySelector } from '../factory';
import createReduxStore from '../redux-store';
import coreDataStore from '../store';

jest.useFakeTimers( { legacyFakeTimers: true } );
beforeEach( () => {
jest.useFakeTimers( 'legacy' );
} );

afterEach( () => {
jest.runOnlyPendingTimers();
jest.useRealTimers();
} );

describe( 'createRegistry', () => {
let registry;
Expand Down
4 changes: 0 additions & 4 deletions packages/e2e-test-utils/CHANGELOG.md
Expand Up @@ -2,10 +2,6 @@

## Unreleased

### Breaking Changes

- Started requiring Jest v29 instead of v27 as a peer dependency. See [breaking changes in Jest 28](https://jestjs.io/blog/2022/04/25/jest-28) and [in jest 29](https://jestjs.io/blog/2022/08/25/jest-29) ([#47388](https://github.com/WordPress/gutenberg/pull/47388))

## 9.5.0 (2023-03-01)

## 9.4.0 (2023-02-15)
Expand Down
2 changes: 1 addition & 1 deletion packages/e2e-test-utils/package.json
Expand Up @@ -38,7 +38,7 @@
"node-fetch": "^2.6.0"
},
"peerDependencies": {
"jest": ">=29",
"jest": ">=27",
"puppeteer-core": ">=11"
},
"publishConfig": {
Expand Down
4 changes: 0 additions & 4 deletions packages/e2e-tests/CHANGELOG.md
Expand Up @@ -2,10 +2,6 @@

## Unreleased

### Breaking Changes

- Started requiring Jest v29 instead of v27 as a peer dependency. See [breaking changes in Jest 28](https://jestjs.io/blog/2022/04/25/jest-28) and [in jest 29](https://jestjs.io/blog/2022/08/25/jest-29) ([#47388](https://github.com/WordPress/gutenberg/pull/47388))

## 6.5.0 (2023-03-01)

## 6.4.0 (2023-02-15)
Expand Down
7 changes: 0 additions & 7 deletions packages/e2e-tests/babel.config.js

This file was deleted.

6 changes: 3 additions & 3 deletions packages/e2e-tests/package.json
Expand Up @@ -31,13 +31,13 @@
"chalk": "^4.0.0",
"expect-puppeteer": "^4.4.0",
"filenamify": "^4.2.0",
"jest-message-util": "^29.5.0",
"jest-snapshot": "^29.5.0",
"jest-message-util": "^27.4.2",
"jest-snapshot": "^27.4.5",
"puppeteer-testing-library": "^0.5.0",
"uuid": "^8.3.0"
},
"peerDependencies": {
"jest": ">=29",
"jest": ">=27",
"puppeteer-core": ">=11",
"react": "^18.0.0",
"react-dom": "^18.0.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/edit-post/src/test/editor.native.js
Expand Up @@ -26,7 +26,7 @@ const unsupportedBlock = `
`;

beforeAll( () => {
jest.useFakeTimers( { legacyFakeTimers: true } );
jest.useFakeTimers( 'legacy' );
} );

afterAll( () => {
Expand Down
6 changes: 4 additions & 2 deletions packages/editor/src/components/autosave-monitor/test/index.js
Expand Up @@ -8,18 +8,20 @@ import { render } from '@testing-library/react';
*/
import { AutosaveMonitor } from '../';

jest.useFakeTimers( { legacyFakeTimers: true } );

describe( 'AutosaveMonitor', () => {
let setAutosaveTimerSpy;
beforeEach( () => {
jest.useFakeTimers( 'legacy' );
setAutosaveTimerSpy = jest.spyOn(
AutosaveMonitor.prototype,
'setAutosaveTimer'
);
} );

afterEach( () => {
jest.runOnlyPendingTimers();
jest.useRealTimers();

setAutosaveTimerSpy.mockClear();
} );

Expand Down
2 changes: 1 addition & 1 deletion packages/format-library/src/link/test/index.native.js
Expand Up @@ -27,7 +27,7 @@ const LinkEditSlot = ( props ) => (
jest.spyOn( Keyboard, 'dismiss' );

beforeAll( () => {
jest.useFakeTimers( { legacyFakeTimers: true } );
jest.useFakeTimers( 'legacy' );
} );

afterAll( () => {
Expand Down
4 changes: 0 additions & 4 deletions packages/jest-console/CHANGELOG.md
Expand Up @@ -2,10 +2,6 @@

## Unreleased

### Breaking Changes

- Started requiring Jest v29 instead of v27 as a peer dependency. See [breaking changes in Jest 28](https://jestjs.io/blog/2022/04/25/jest-28) and [in jest 29](https://jestjs.io/blog/2022/08/25/jest-29) ([#47388](https://github.com/WordPress/gutenberg/pull/47388))

## 6.11.0 (2023-03-01)

## 6.10.0 (2023-02-15)
Expand Down
4 changes: 2 additions & 2 deletions packages/jest-console/package.json
Expand Up @@ -33,10 +33,10 @@
"types": "types",
"dependencies": {
"@babel/runtime": "^7.16.0",
"jest-matcher-utils": "^29.5.0"
"jest-matcher-utils": "^27.4.2"
},
"peerDependencies": {
"jest": ">=29"
"jest": ">=27"
},
"publishConfig": {
"access": "public"
Expand Down
4 changes: 0 additions & 4 deletions packages/jest-preset-default/CHANGELOG.md
Expand Up @@ -2,10 +2,6 @@

## Unreleased

### Breaking Changes

- Started requiring Jest v29 instead of v27 as a peer dependency. See [breaking changes in Jest 28](https://jestjs.io/blog/2022/04/25/jest-28) and [in jest 29](https://jestjs.io/blog/2022/08/25/jest-29) ([#47388](https://github.com/WordPress/gutenberg/pull/47388))

## 10.9.0 (2023-03-01)

## 10.8.0 (2023-02-15)
Expand Down
1 change: 1 addition & 0 deletions packages/jest-preset-default/jest-preset.js
Expand Up @@ -24,6 +24,7 @@ module.exports = {
'**/?(*.)test.[jt]s?(x)',
],
testPathIgnorePatterns: [ '/node_modules/', '<rootDir>/vendor/' ],
timers: 'real',
transform: {
'\\.[jt]sx?$': require.resolve( 'babel-jest' ),
},
Expand Down
4 changes: 2 additions & 2 deletions packages/jest-preset-default/package.json
Expand Up @@ -31,11 +31,11 @@
"main": "index.js",
"dependencies": {
"@wordpress/jest-console": "file:../jest-console",
"babel-jest": "^29.5.0"
"babel-jest": "^27.4.5"
},
"peerDependencies": {
"@babel/core": ">=7",
"jest": ">=29"
"jest": ">=27"
},
"publishConfig": {
"access": "public"
Expand Down
4 changes: 0 additions & 4 deletions packages/jest-puppeteer-axe/CHANGELOG.md
Expand Up @@ -2,10 +2,6 @@

## Unreleased

### Breaking Changes

- Started requiring Jest v29 instead of v27 as a peer dependency. See [breaking changes in Jest 28](https://jestjs.io/blog/2022/04/25/jest-28) and [in jest 29](https://jestjs.io/blog/2022/08/25/jest-29) ([#47388](https://github.com/WordPress/gutenberg/pull/47388))

## 5.11.0 (2023-03-01)

## 5.10.0 (2023-02-15)
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-puppeteer-axe/package.json
Expand Up @@ -35,7 +35,7 @@
"@babel/runtime": "^7.16.0"
},
"peerDependencies": {
"jest": ">=29",
"jest": ">=27",
"puppeteer": ">=11"
},
"peerDependenciesMeta": {
Expand Down
1 change: 1 addition & 0 deletions packages/react-native-editor/jest_ui.config.js
Expand Up @@ -18,6 +18,7 @@ module.exports = {
transform: {
'^.+\\.(js|ts|tsx)$': 'babel-jest',
},
timers: 'real',
setupFilesAfterEnv: [ './jest_ui_setup_after_env.js' ],
testEnvironment: './jest_ui_test_environment.js',
testMatch: [ '**/__device-tests__/**/*.test.[jt]s?(x)' ],
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native-editor/jest_ui_test_environment.js
Expand Up @@ -12,7 +12,7 @@ const testData = require( './__device-tests__/helpers/test-data' );
* External dependencies
*/
// eslint-disable-next-line import/no-extraneous-dependencies
const JSDOMEnvironment = require( 'jest-environment-jsdom' ).default;
const JSDOMEnvironment = require( 'jest-environment-jsdom' );

class CustomEnvironment extends JSDOMEnvironment {
async setup() {
Expand Down
2 changes: 1 addition & 1 deletion packages/report-flaky-tests/package.json
Expand Up @@ -28,7 +28,7 @@
"dependencies": {
"@actions/core": "^1.8.0",
"@actions/github": "^5.0.1",
"jest-message-util": "^29.5.0"
"jest-message-util": "^28.0.2"
},
"publishConfig": {
"access": "public"
Expand Down
4 changes: 0 additions & 4 deletions packages/scripts/CHANGELOG.md
Expand Up @@ -2,10 +2,6 @@

## Unreleased

### Breaking Changes

- Started using Jest v29 instead of v27 as a dependency. See [breaking changes in Jest 28](https://jestjs.io/blog/2022/04/25/jest-28) and [in jest 29](https://jestjs.io/blog/2022/08/25/jest-29) ([#47388](https://github.com/WordPress/gutenberg/pull/47388))

## 25.5.1 (2023-03-06)

### Bug Fix
Expand Down
8 changes: 6 additions & 2 deletions packages/scripts/config/jest-environment-puppeteer/index.js
Expand Up @@ -19,7 +19,7 @@
const path = require( 'path' );
const { writeFile, mkdir } = require( 'fs' ).promises;
const filenamify = require( 'filenamify' );
const NodeEnvironment = require( 'jest-environment-node' ).default;
const NodeEnvironment = require( 'jest-environment-node' );
const chalk = require( 'chalk' );

/**
Expand Down Expand Up @@ -52,7 +52,11 @@ class PuppeteerEnvironment extends NodeEnvironment {
// Jest is not available here, so we have to reverse engineer
// the setTimeout function, see https://github.com/facebook/jest/blob/v23.1.0/packages/jest-runtime/src/index.js#L823
setTimeout( timeout ) {
this.global[ Symbol.for( 'TEST_TIMEOUT_SYMBOL' ) ] = timeout;
if ( this.global.jasmine ) {
this.global.jasmine.DEFAULT_TIMEOUT_INTERVAL = timeout;
} else {
this.global[ Symbol.for( 'TEST_TIMEOUT_SYMBOL' ) ] = timeout;
}
}

async setup() {
Expand Down
7 changes: 3 additions & 4 deletions packages/scripts/package.json
Expand Up @@ -45,7 +45,7 @@
"@wordpress/prettier-config": "file:../prettier-config",
"@wordpress/stylelint-config": "file:../stylelint-config",
"adm-zip": "^0.5.9",
"babel-jest": "^29.5.0",
"babel-jest": "^27.4.5",
"babel-loader": "^8.2.3",
"browserslist": "^4.17.6",
"chalk": "^4.0.0",
Expand All @@ -61,10 +61,9 @@
"expect-puppeteer": "^4.4.0",
"fast-glob": "^3.2.7",
"filenamify": "^4.2.0",
"jest": "^29.5.0",
"jest": "^27.4.5",
"jest-dev-server": "^6.0.2",
"jest-environment-jsdom": "^29.5.0",
"jest-environment-node": "^29.5.0",
"jest-environment-node": "^27.4.4",
"markdownlint-cli": "^0.31.1",
"merge-deep": "^3.0.3",
"mini-css-extract-plugin": "^2.5.1",
Expand Down

0 comments on commit 2fbd522

Please sign in to comment.