diff --git a/CHANGELOG.md b/CHANGELOG.md index a8175d2a73b6..0f08d85f220d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ - `[jest-circus, jest-console, jest-jasmine2, jest-reporters, jest-util, pretty-format]` Fix time durating formatting and consolidate time formatting code ([#9765](https://github.com/facebook/jest/pull/9765)) - `[jest-circus]` [**BREAKING**] Fail tests if a test takes a done callback and have return values ([#9129](https://github.com/facebook/jest/pull/9129)) - `[jest-config, jest-resolve]` [**BREAKING**] Remove support for `browser` field ([#9943](https://github.com/facebook/jest/pull/9943)) +- `[jest-reporters]` Revert: Transform file paths into hyperlinks ([#9294](https://github.com/facebook/jest/pull/9294)) ### Chore & Maintenance diff --git a/packages/jest-reporters/package.json b/packages/jest-reporters/package.json index 584ed3291e61..4f65ddbb0c87 100644 --- a/packages/jest-reporters/package.json +++ b/packages/jest-reporters/package.json @@ -27,7 +27,6 @@ "slash": "^3.0.0", "source-map": "^0.6.0", "string-length": "^3.1.0", - "terminal-link": "^2.0.0", "v8-to-istanbul": "^4.1.3" }, "devDependencies": { diff --git a/packages/jest-reporters/src/__tests__/get_result_header.test.js b/packages/jest-reporters/src/__tests__/get_result_header.test.js deleted file mode 100644 index 3c0c3351ae3e..000000000000 --- a/packages/jest-reporters/src/__tests__/get_result_header.test.js +++ /dev/null @@ -1,38 +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 {makeGlobalConfig} from '../../../../TestUtils'; -import getResultHeader from '../get_result_header'; -const terminalLink = require('terminal-link'); - -jest.mock('terminal-link', () => jest.fn(() => 'wannabehyperlink')); - -const testResult = { - testFilePath: '/foo', -}; - -const globalConfig = makeGlobalConfig(); - -beforeEach(() => { - terminalLink.mockClear(); -}); - -test('should call `terminal-link` correctly', () => { - getResultHeader(testResult, globalConfig); - - expect(terminalLink).toBeCalledWith( - expect.stringContaining('foo'), - 'file:///foo', - expect.objectContaining({fallback: expect.any(Function)}), - ); -}); - -test('should render the terminal link', () => { - const result = getResultHeader(testResult, globalConfig); - - expect(result).toContain('wannabehyperlink'); -}); diff --git a/packages/jest-reporters/src/get_result_header.ts b/packages/jest-reporters/src/get_result_header.ts index 2b9dd7b25403..391178f95c9c 100644 --- a/packages/jest-reporters/src/get_result_header.ts +++ b/packages/jest-reporters/src/get_result_header.ts @@ -10,7 +10,6 @@ import type {TestResult} from '@jest/test-result'; import chalk = require('chalk'); import {formatTime} from 'jest-util'; import {formatTestPath, printDisplayName} from './utils'; -import terminalLink = require('terminal-link'); const LONG_TEST_COLOR = chalk.reset.bold.bgRed; // Explicitly reset for these messages since they can get written out in the @@ -32,13 +31,6 @@ export default ( projectConfig?: Config.ProjectConfig, ): string => { const testPath = result.testFilePath; - const formattedTestPath = formatTestPath( - projectConfig ? projectConfig : globalConfig, - testPath, - ); - const fileLink = terminalLink(formattedTestPath, `file://${testPath}`, { - fallback: () => formattedTestPath, - }); const status = result.numFailingTests > 0 || result.testExecError ? FAIL : PASS; @@ -62,7 +54,9 @@ export default ( : ''; return ( - `${status} ${projectDisplayName}${fileLink}` + - (testDetail.length ? ` (${testDetail.join(', ')})` : '') + `${status} ${projectDisplayName}${formatTestPath( + projectConfig || globalConfig, + testPath, + )}` + (testDetail.length ? ` (${testDetail.join(', ')})` : '') ); }; diff --git a/yarn.lock b/yarn.lock index 60ec64f23232..e9a857ae87ea 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4938,20 +4938,13 @@ cssom@~0.3.6: resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.3.8.tgz#9f1276f5b2b463f2114d3f2c75250af8c1a36f4a" integrity sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg== -cssstyle@^2.0.0: +cssstyle@^2.0.0, cssstyle@^2.2.0: version "2.3.0" resolved "https://registry.yarnpkg.com/cssstyle/-/cssstyle-2.3.0.tgz#ff665a0ddbdc31864b09647f34163443d90b0852" integrity sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A== dependencies: cssom "~0.3.6" -cssstyle@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/cssstyle/-/cssstyle-2.2.0.tgz#e4c44debccd6b7911ed617a4395e5754bba59992" - integrity sha512-sEb3XFPx3jNnCAMtqrXPDeSgQr+jojtCeNf8cvMNMh1cG970+lljssvQDzPq6lmmJu2Vhqood/gtEomBiHOGnA== - dependencies: - cssom "~0.3.6" - csstype@^2.2.0: version "2.6.10" resolved "https://registry.yarnpkg.com/csstype/-/csstype-2.6.10.tgz#e63af50e66d7c266edb6b32909cfd0aabe03928b" @@ -13023,7 +13016,7 @@ source-map-resolve@^0.5.0: source-map-url "^0.4.0" urix "^0.1.0" -source-map-support@^0.5.16: +source-map-support@^0.5.16, source-map-support@^0.5.6: version "0.5.16" resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.16.tgz#0ae069e7fe3ba7538c64c98515e35339eac5a042" integrity sha512-efyLRJDr68D9hBBNIPWFjhpFzURh+KJykQwvMyW5UiZzYwoF6l4YMMDIJJEyFWxWCqfyxLzz6tSfUFR+kXXsVQ== @@ -13031,14 +13024,6 @@ source-map-support@^0.5.16: buffer-from "^1.0.0" source-map "^0.6.0" -source-map-support@^0.5.6: - version "0.5.13" - resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.13.tgz#31b24a9c2e73c2de85066c0feb7d44767ed52932" - integrity sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w== - dependencies: - buffer-from "^1.0.0" - source-map "^0.6.0" - source-map-url@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.0.tgz#3e935d7ddd73631b97659956d55128e87b5084a3"