From 5bcbef38f36622360dec5458be838e92063f419e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Mon, 4 May 2020 19:19:16 +0200 Subject: [PATCH 1/6] chore: remove mapCoverage remainings --- packages/jest-cli/src/cli/args.ts | 7 ------- packages/jest-config/src/normalize.ts | 1 - packages/jest-types/src/Config.ts | 1 - packages/jest-types/src/Transform.ts | 1 - 4 files changed, 10 deletions(-) diff --git a/packages/jest-cli/src/cli/args.ts b/packages/jest-cli/src/cli/args.ts index fe74a2f6c4c1..60384b41fe1c 100644 --- a/packages/jest-cli/src/cli/args.ts +++ b/packages/jest-cli/src/cli/args.ts @@ -361,13 +361,6 @@ export const options = { 'node.', type: 'boolean', }, - mapCoverage: { - default: undefined, - description: - 'Maps code coverage reports against original source code ' + - 'when transformers supply source maps.\n\nDEPRECATED', - type: 'boolean', - }, maxConcurrency: { default: 5, description: diff --git a/packages/jest-config/src/normalize.ts b/packages/jest-config/src/normalize.ts index e31cefaa3bf4..d2e2f060fbef 100644 --- a/packages/jest-config/src/normalize.ts +++ b/packages/jest-config/src/normalize.ts @@ -958,7 +958,6 @@ export default function normalize( case 'listTests': case 'logHeapUsage': case 'maxConcurrency': - case 'mapCoverage': case 'name': case 'noStackTrace': case 'notify': diff --git a/packages/jest-types/src/Config.ts b/packages/jest-types/src/Config.ts index 40da453ae5e8..8b8243994a0e 100644 --- a/packages/jest-types/src/Config.ts +++ b/packages/jest-types/src/Config.ts @@ -155,7 +155,6 @@ export type InitialOptions = Partial<{ logHeapUsage: boolean; lastCommit: boolean; listTests: boolean; - mapCoverage: boolean; maxConcurrency: number; maxWorkers: number | string; moduleDirectories: Array; diff --git a/packages/jest-types/src/Transform.ts b/packages/jest-types/src/Transform.ts index 6371a226c201..43e9ff986eb1 100644 --- a/packages/jest-types/src/Transform.ts +++ b/packages/jest-types/src/Transform.ts @@ -9,6 +9,5 @@ export type TransformResult = { code: string; originalCode: string; - mapCoverage?: boolean; // TODO - Remove in Jest 27 sourceMapPath: string | null; }; From ef684c85cfe34828f4652eb08af471b59330bb4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Mon, 4 May 2020 19:21:23 +0200 Subject: [PATCH 2/6] add changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 692ac1876000..ef1db8a79099 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -324,6 +324,7 @@ - `[*]` [**BREAKING**] TypeScript definitions requires a minimum of TypeScript v3.8 ([#9823](https://github.com/facebook/jest/pull/9823)) - `[*]` [**BREAKING**] Drop support for Node 8 ([#9423](https://github.com/facebook/jest/pull/9423)) +- `[*]` [**BREAKING**] Remove deprecated `mapCoverage` ([#9968](https://github.com/facebook/jest/pull/9968)) - `[*]` Upgrade to chalk@4 ([#9752](https://github.com/facebook/jest/pull/9752)) - `[*]` Remove usage of `realpath-native` ([#9952](https://github.com/facebook/jest/pull/9952)) - `[docs]` Fix example reference implementation to use Jest with Phabricator ([#8662](https://github.com/facebook/jest/pull/8662)) From 4fbbc7c6f9e440bd5ceb01a37d0eb6ecaa49cf37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Mon, 4 May 2020 19:21:55 +0200 Subject: [PATCH 3/6] revert circus adapter changes --- .../src/legacy-code-todo-rewrite/jestAdapter.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapter.ts b/packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapter.ts index 14daeec22f59..8ea50b72ba36 100644 --- a/packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapter.ts +++ b/packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapter.ts @@ -72,7 +72,8 @@ const jestAdapter = async ( }); for (const path of config.setupFilesAfterEnv) { - const esm = runtime.unstable_shouldLoadAsEsm(path); + // TODO: remove ? in Jest 26 + const esm = runtime.unstable_shouldLoadAsEsm?.(path); if (esm) { await runtime.unstable_importModule(path); @@ -80,7 +81,9 @@ const jestAdapter = async ( runtime.requireModule(path); } } - const esm = runtime.unstable_shouldLoadAsEsm(testPath); + + // TODO: remove ? in Jest 26 + const esm = runtime.unstable_shouldLoadAsEsm?.(testPath); if (esm) { await runtime.unstable_importModule(testPath); From 75f45006317d48e9a7e91a1095cd1c6d895ad839 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Mon, 4 May 2020 19:22:35 +0200 Subject: [PATCH 4/6] sort changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ef1db8a79099..d6efd61b052c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -322,9 +322,9 @@ ### Chore & Maintenance -- `[*]` [**BREAKING**] TypeScript definitions requires a minimum of TypeScript v3.8 ([#9823](https://github.com/facebook/jest/pull/9823)) - `[*]` [**BREAKING**] Drop support for Node 8 ([#9423](https://github.com/facebook/jest/pull/9423)) - `[*]` [**BREAKING**] Remove deprecated `mapCoverage` ([#9968](https://github.com/facebook/jest/pull/9968)) +- `[*]` [**BREAKING**] TypeScript definitions requires a minimum of TypeScript v3.8 ([#9823](https://github.com/facebook/jest/pull/9823)) - `[*]` Upgrade to chalk@4 ([#9752](https://github.com/facebook/jest/pull/9752)) - `[*]` Remove usage of `realpath-native` ([#9952](https://github.com/facebook/jest/pull/9952)) - `[docs]` Fix example reference implementation to use Jest with Phabricator ([#8662](https://github.com/facebook/jest/pull/8662)) From 3b1da5dfac25f42e026b079c69e273d2743405f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Mon, 4 May 2020 19:48:10 +0200 Subject: [PATCH 5/6] remove mapCoverage deprecations --- e2e/__tests__/deprecatedCliOptions.test.ts | 25 ------------------- e2e/deprecated-cli-options/__tests__/dummy.js | 10 -------- e2e/deprecated-cli-options/package.json | 3 --- .../legacy-code-todo-rewrite/jestAdapter.ts | 7 ++---- packages/jest-config/src/Deprecated.ts | 6 ----- 5 files changed, 2 insertions(+), 49 deletions(-) delete mode 100644 e2e/__tests__/deprecatedCliOptions.test.ts delete mode 100644 e2e/deprecated-cli-options/__tests__/dummy.js delete mode 100644 e2e/deprecated-cli-options/package.json diff --git a/e2e/__tests__/deprecatedCliOptions.test.ts b/e2e/__tests__/deprecatedCliOptions.test.ts deleted file mode 100644 index 4334b065dc43..000000000000 --- a/e2e/__tests__/deprecatedCliOptions.test.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -import * as path from 'path'; -import runJest from '../runJest'; - -const dir = path.resolve(__dirname, '../deprecated-cli-options'); - -it('Prints deprecation warnings for CLI flags', () => { - const {stderr, exitCode} = runJest(dir, ['--mapCoverage']); - expect(exitCode).toBe(0); - expect(stderr).toMatch(/Test Suites: 1 passed, 1 total/); - expect(stderr).toMatch(`● Deprecation Warning: - - Option "mapCoverage" has been removed, as it's no longer necessary. - - Please update your configuration. - - CLI Options Documentation: - https://jestjs.io/docs/en/cli.html`); -}); diff --git a/e2e/deprecated-cli-options/__tests__/dummy.js b/e2e/deprecated-cli-options/__tests__/dummy.js deleted file mode 100644 index 1925b3756db7..000000000000 --- a/e2e/deprecated-cli-options/__tests__/dummy.js +++ /dev/null @@ -1,10 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -test('Dummy', () => { - expect(2).toBe(2); -}); diff --git a/e2e/deprecated-cli-options/package.json b/e2e/deprecated-cli-options/package.json deleted file mode 100644 index 586d4ca6b75c..000000000000 --- a/e2e/deprecated-cli-options/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "jest": {} -} diff --git a/packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapter.ts b/packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapter.ts index 8ea50b72ba36..14daeec22f59 100644 --- a/packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapter.ts +++ b/packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapter.ts @@ -72,8 +72,7 @@ const jestAdapter = async ( }); for (const path of config.setupFilesAfterEnv) { - // TODO: remove ? in Jest 26 - const esm = runtime.unstable_shouldLoadAsEsm?.(path); + const esm = runtime.unstable_shouldLoadAsEsm(path); if (esm) { await runtime.unstable_importModule(path); @@ -81,9 +80,7 @@ const jestAdapter = async ( runtime.requireModule(path); } } - - // TODO: remove ? in Jest 26 - const esm = runtime.unstable_shouldLoadAsEsm?.(testPath); + const esm = runtime.unstable_shouldLoadAsEsm(testPath); if (esm) { await runtime.unstable_importModule(testPath); diff --git a/packages/jest-config/src/Deprecated.ts b/packages/jest-config/src/Deprecated.ts index 0e0bc23ee732..f43ec9d4d7a2 100644 --- a/packages/jest-config/src/Deprecated.ts +++ b/packages/jest-config/src/Deprecated.ts @@ -20,12 +20,6 @@ const deprecatedOptions: DeprecatedOptions = { } `, - mapCoverage: () => ` Option ${chalk.bold( - '"mapCoverage"', - )} has been removed, as it's no longer necessary. - - Please update your configuration.`, - preprocessorIgnorePatterns: (options: { preprocessorIgnorePatterns?: Array; }) => ` Option ${chalk.bold( From 5387e4fe9f1f3757756067a0d5b72e04964049ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Sun, 6 Dec 2020 13:09:52 +0100 Subject: [PATCH 6/6] update changelog --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d6efd61b052c..8906b1b307b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -59,6 +59,7 @@ - `[jest-runtime]` [**BREAKING**] Remove deprecated and unnused `getSourceMapInfo` from Runtime ([#9969](https://github.com/facebook/jest/pull/9969)) - `[jest-util]` No longer checking `enumerable` when adding `process.domain` ([#10862](https://github.com/facebook/jest/pull/10862)) - `[jest-validate]` [**BREAKING**] Remove `recursiveBlacklist ` option in favor of previously introduced `recursiveDenylist` ([#10650](https://github.com/facebook/jest/pull/10650)) +- `[*]` [**BREAKING**] Remove deprecated `mapCoverage` ([#9968](https://github.com/facebook/jest/pull/9968)) ### Performance @@ -322,9 +323,8 @@ ### Chore & Maintenance -- `[*]` [**BREAKING**] Drop support for Node 8 ([#9423](https://github.com/facebook/jest/pull/9423)) -- `[*]` [**BREAKING**] Remove deprecated `mapCoverage` ([#9968](https://github.com/facebook/jest/pull/9968)) - `[*]` [**BREAKING**] TypeScript definitions requires a minimum of TypeScript v3.8 ([#9823](https://github.com/facebook/jest/pull/9823)) +- `[*]` [**BREAKING**] Drop support for Node 8 ([#9423](https://github.com/facebook/jest/pull/9423)) - `[*]` Upgrade to chalk@4 ([#9752](https://github.com/facebook/jest/pull/9752)) - `[*]` Remove usage of `realpath-native` ([#9952](https://github.com/facebook/jest/pull/9952)) - `[docs]` Fix example reference implementation to use Jest with Phabricator ([#8662](https://github.com/facebook/jest/pull/8662))