Skip to content

Commit

Permalink
Merge branch 'main' into jsdom-19
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Feb 10, 2022
2 parents 3c3e216 + a651b65 commit 5693212
Show file tree
Hide file tree
Showing 18 changed files with 250 additions and 329 deletions.
8 changes: 6 additions & 2 deletions .eslintplugin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ exports.rules = {
'ban-types-eventually': require('@typescript-eslint/eslint-plugin').rules[
'ban-types'
],
'prefer-rest-params-eventually': require('eslint/lib/rules/prefer-rest-params'),
'prefer-spread-eventually': require('eslint/lib/rules/prefer-spread'),
'prefer-rest-params-eventually':
require('eslint/use-at-your-own-risk').builtinRules.get(
'prefer-rest-params',
),
'prefer-spread-eventually':
require('eslint/use-at-your-own-risk').builtinRules.get('prefer-spread'),
};
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
### Features

- `[expect]` [**BREAKING**] Migrate to ESM ([#12344](https://github.com/facebook/jest/pull/12344))
- `[jest-config]` [**BREAKING**] Stop shipping `jest-jasmine2` by default ([#12355](https://github.com/facebook/jest/pull/12355))
- `[jest-environment-jsdom]` [**BREAKING**] Upgrade jsdom to 19.0.0 ([#12290](https://github.com/facebook/jest/pull/12290))
- `[jest-environment-jsdom]` [**BREAKING**] Add default `browser` condition to `exportConditions` for `jsdom` environment ([#11924](https://github.com/facebook/jest/pull/11924))
- `[jest-environment-jsdom]` [**BREAKING**] Migrate to ESM ([#12340](https://github.com/facebook/jest/pull/12340))
Expand All @@ -23,7 +24,10 @@
- `[*]` [**BREAKING**] Drop support for `[email protected]`, minimum version is now `4.2` ([#11142](https://github.com/facebook/jest/pull/11142))
- `[*]` Bundle all `.d.ts` files into a single `index.d.ts` per module ([#12345](https://github.com/facebook/jest/pull/12345))
- `[expect]` [**BREAKING**] Remove support for importing `build/utils` ([#12323](https://github.com/facebook/jest/pull/12323))
- `[jest-config]` [**BREAKING**] Remove `getTestEnvironment` export ([#12353](https://github.com/facebook/jest/pull/12353))
- `[@jest/core]` Use `index.ts` instead of `jest.ts` as main export ([#12329](https://github.com/facebook/jest/pull/12329))
- `[jest-resolve]` [**BREAKING**] Make `requireResolveFunction` argument mandatory ([#12353](https://github.com/facebook/jest/pull/12353))
- `[jest-runner]` [**BREAKING**] Remove some type exports from `@jest/test-result` ([#12353](https://github.com/facebook/jest/pull/12353))
- `[jest]` Use `index.ts` instead of `jest.ts` as main export ([#12329](https://github.com/facebook/jest/pull/12329))

### Performance
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
"@types/jest": "^26.0.15",
"@types/node": "~12.12.0",
"@types/which": "^2.0.0",
"@typescript-eslint/eslint-plugin": "^4.1.0",
"@typescript-eslint/parser": "^4.1.0",
"@typescript-eslint/eslint-plugin": "^5.11.0",
"@typescript-eslint/parser": "^5.11.0",
"ansi-regex": "^5.0.1",
"ansi-styles": "^5.0.0",
"camelcase": "^6.2.0",
Expand All @@ -32,15 +32,15 @@
"codecov": "^3.0.0",
"debug": "^4.0.1",
"dedent": "^0.7.0",
"eslint": "^7.7.0",
"eslint": "^8.8.0",
"eslint-config-prettier": "^8.1.0",
"eslint-import-resolver-typescript": "^2.5.0",
"eslint-plugin-eslint-comments": "^3.1.2",
"eslint-plugin-import": "^2.6.0",
"eslint-plugin-jest": "^24.0.0",
"eslint-plugin-jest": "^26.1.0",
"eslint-plugin-local": "^1.0.0",
"eslint-plugin-markdown": "^1.0.0",
"eslint-plugin-prettier": "^3.0.1",
"eslint-plugin-prettier": "^4.0.0",
"execa": "^5.0.0",
"fast-check": "^2.0.0",
"find-process": "^1.4.1",
Expand Down
2 changes: 0 additions & 2 deletions packages/expect-utils/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
*
*/

/* eslint-disable local/ban-types-eventually */

import {isPrimitive} from 'jest-get-type';
import {
equals,
Expand Down
2 changes: 0 additions & 2 deletions packages/expect/src/asymmetricMatchers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ const utils = Object.freeze({
subsetEquality,
});

// eslint-disable-next-line @typescript-eslint/ban-types
function getPrototype(obj: object) {
if (Object.getPrototypeOf) {
return Object.getPrototypeOf(obj);
Expand All @@ -51,7 +50,6 @@ function getPrototype(obj: object) {
return obj.constructor.prototype;
}

// eslint-disable-next-line @typescript-eslint/ban-types
export function hasProperty(obj: object | null, property: string): boolean {
if (!obj) {
return false;
Expand Down
1 change: 0 additions & 1 deletion packages/jest-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
"jest-environment-jsdom": "^27.5.1",
"jest-environment-node": "^27.5.1",
"jest-get-type": "^27.5.1",
"jest-jasmine2": "^27.5.1",
"jest-regex-util": "^27.5.1",
"jest-resolve": "^27.5.1",
"jest-runner": "^27.5.1",
Expand Down
3 changes: 0 additions & 3 deletions packages/jest-config/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ import readConfigFileAndSetRootDir from './readConfigFileAndSetRootDir';
import resolveConfigPath from './resolveConfigPath';
import {isJSONString, replaceRootDirInPath} from './utils';

// TODO: remove export in Jest 28
export {resolveTestEnvironment as getTestEnvironment} from 'jest-resolve';

export {isJSONString} from './utils';
export {default as normalize} from './normalize';
export {default as deprecationEntries} from './Deprecated';
Expand Down
15 changes: 13 additions & 2 deletions packages/jest-config/src/normalize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -626,11 +626,22 @@ export default async function normalize(
if (
!options.testRunner ||
options.testRunner === 'circus' ||
options.testRunner === 'jest-circus'
options.testRunner === 'jest-circus' ||
options.testRunner === 'jest-circus/runner'
) {
options.testRunner = require.resolve('jest-circus/runner');
} else if (options.testRunner === 'jasmine2') {
options.testRunner = require.resolve('jest-jasmine2');
try {
options.testRunner = require.resolve('jest-jasmine2');
} catch (error: any) {
if (error.code === 'MODULE_NOT_FOUND') {
createConfigError(
'jest-jasmine is no longer shipped by default with Jest, you need to install it explicitly or provide an absolute path to Jest',
);
}

throw error;
}
}

if (!options.coverageDirectory) {
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-config/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
},
"include": ["./src/**/*"],
"exclude": ["./**/__mocks__/**/*", "./**/__tests__/**/*"],
// TODO: This is missing `babel-jest`, `jest-jasmine2`, `jest-circus` and
// TODO: This is missing `babel-jest`, `jest-circus` and
// jest-test-sequencer, but that is just `require.resolve`d, so no real use
// for their types
"references": [
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-jasmine2/src/jasmine/Suite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

/* eslint-disable local/ban-types-eventually, sort-keys, local/prefer-spread-eventually, local/prefer-rest-params-eventually */
/* eslint-disable sort-keys, local/prefer-spread-eventually, local/prefer-rest-params-eventually */

import type {Config} from '@jest/types';
import {convertDescriptorToString} from 'jest-util';
Expand Down
2 changes: 0 additions & 2 deletions packages/jest-leak-detector/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
* LICENSE file in the root directory of this source tree.
*/

/* eslint-disable local/ban-types-eventually */

import {promisify} from 'util';
import {setFlagsFromString} from 'v8';
import {runInNewContext} from 'vm';
Expand Down
20 changes: 8 additions & 12 deletions packages/jest-resolve/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,11 @@ const resolveWithPrefix = (
export const resolveTestEnvironment = ({
rootDir,
testEnvironment: filePath,
// TODO: remove default in Jest 28
requireResolveFunction = require.resolve,
requireResolveFunction,
}: {
rootDir: Config.Path;
testEnvironment: string;
requireResolveFunction?: (moduleName: string) => string;
requireResolveFunction: (moduleName: string) => string;
}): string =>
resolveWithPrefix(undefined, {
filePath,
Expand All @@ -125,12 +124,11 @@ export const resolveWatchPlugin = (
{
filePath,
rootDir,
// TODO: remove default in Jest 28
requireResolveFunction = require.resolve,
requireResolveFunction,
}: {
filePath: string;
rootDir: Config.Path;
requireResolveFunction?: (moduleName: string) => string;
requireResolveFunction: (moduleName: string) => string;
},
): string =>
resolveWithPrefix(resolver, {
Expand All @@ -155,12 +153,11 @@ export const resolveRunner = (
{
filePath,
rootDir,
// TODO: remove default in Jest 28
requireResolveFunction = require.resolve,
requireResolveFunction,
}: {
filePath: string;
rootDir: Config.Path;
requireResolveFunction?: (moduleName: string) => string;
requireResolveFunction: (moduleName: string) => string;
},
): string =>
resolveWithPrefix(resolver, {
Expand All @@ -177,12 +174,11 @@ export const resolveSequencer = (
{
filePath,
rootDir,
// TODO: remove default in Jest 28
requireResolveFunction = require.resolve,
requireResolveFunction,
}: {
filePath: string;
rootDir: Config.Path;
requireResolveFunction?: (moduleName: string) => string;
requireResolveFunction: (moduleName: string) => string;
},
): string =>
resolveWithPrefix(resolver, {
Expand Down
3 changes: 0 additions & 3 deletions packages/jest-runner/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ import type {
TestWatcher,
} from './types';

// TODO: remove re-export in Jest 28
export type {Test, TestFileEvent, TestEvents} from '@jest/test-result';

const TEST_WORKER_PATH = require.resolve('./testWorker');

interface WorkerInterface extends Worker {
Expand Down
2 changes: 0 additions & 2 deletions packages/jest-snapshot/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
* LICENSE file in the root directory of this source tree.
*/

/* eslint-disable local/ban-types-eventually */

import * as fs from 'graceful-fs';
import type {Config} from '@jest/types';
import type {FS as HasteFS} from 'jest-haste-map';
Expand Down
2 changes: 0 additions & 2 deletions packages/jest-snapshot/src/printSnapshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
* LICENSE file in the root directory of this source tree.
*/

/* eslint-disable local/ban-types-eventually */

import chalk = require('chalk');
import {getObjectSubset} from '@jest/expect-utils';
import {
Expand Down
2 changes: 0 additions & 2 deletions packages/jest-snapshot/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
* LICENSE file in the root directory of this source tree.
*/

/* eslint-disable local/ban-types-eventually */

import type {MatcherState} from 'expect';
import type SnapshotState from './State';

Expand Down
2 changes: 0 additions & 2 deletions packages/pretty-format/src/plugins/DOMCollection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
* LICENSE file in the root directory of this source tree.
*/

/* eslint-disable local/ban-types-eventually */

import {printListItems, printObjectProperties} from '../collections';
import type {Config, NewPlugin, Printer, Refs} from '../types';

Expand Down
Loading

0 comments on commit 5693212

Please sign in to comment.