From 53d93fa202d624798dcc745239b3ac9034351298 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Wed, 11 Dec 2019 12:50:48 +0100 Subject: [PATCH] Revert "feat: transform file paths into hyperlinks (#8980)" This reverts commit 01fd3a482051822533137844c944223a08165c2d. --- CHANGELOG.md | 1 + packages/jest-reporters/package.json | 1 - .../src/__tests__/get_result_header.test.js | 38 ------------------- .../jest-reporters/src/get_result_header.ts | 14 ++----- yarn.lock | 16 -------- 5 files changed, 5 insertions(+), 65 deletions(-) delete mode 100644 packages/jest-reporters/src/__tests__/get_result_header.test.js diff --git a/CHANGELOG.md b/CHANGELOG.md index e6422a6724cf..a547882d4fa3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ - `[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 27223625b0df..a236f458e7e0 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 ff2c951cf039..5e523c25edf4 100644 --- a/packages/jest-reporters/src/get_result_header.ts +++ b/packages/jest-reporters/src/get_result_header.ts @@ -9,7 +9,6 @@ import type {Config} from '@jest/types'; import type {TestResult} from '@jest/test-result'; import chalk = require('chalk'); 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 @@ -31,13 +30,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; @@ -61,7 +53,9 @@ export default ( : ''; return ( - `${status} ${projectDisplayName}${fileLink}` + - (testDetail.length ? ` (${testDetail.join(', ')})` : '') + `${status} ${projectDisplayName}${formatTestPath( + projectConfig ? projectConfig : globalConfig, + testPath, + )}` + (testDetail.length ? ` (${testDetail.join(', ')})` : '') ); }; diff --git a/yarn.lock b/yarn.lock index c580faf092eb..6f7bed6c42e9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12794,14 +12794,6 @@ supports-color@^7.0.0, supports-color@^7.1.0: dependencies: has-flag "^4.0.0" -supports-hyperlinks@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/supports-hyperlinks/-/supports-hyperlinks-2.1.0.tgz#f663df252af5f37c5d49bbd7eeefa9e0b9e59e47" - integrity sha512-zoE5/e+dnEijk6ASB6/qrK+oYdm2do1hjoLWrqUC/8WEIW1gbxFcKuBof7sW8ArN6e+AYvsE8HBGiVRWL/F5CA== - dependencies: - has-flag "^4.0.0" - supports-color "^7.0.0" - svgo@^1.0.0, svgo@^1.3.2: version "1.3.2" resolved "https://registry.yarnpkg.com/svgo/-/svgo-1.3.2.tgz#b6dc511c063346c9e415b81e43401145b96d4167" @@ -12933,14 +12925,6 @@ tempy@~0.3.0: type-fest "^0.3.1" unique-string "^1.0.0" -terminal-link@^2.0.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/terminal-link/-/terminal-link-2.1.1.tgz#14a64a27ab3c0df933ea546fba55f2d078edc994" - integrity sha512-un0FmiRUQNr5PJqy9kP7c40F5BOfpGlYTrxonDChEZB7pzZxRNp/bt+ymiy9/npwXya9KH99nJ/GXFIiUkYGFQ== - dependencies: - ansi-escapes "^4.2.1" - supports-hyperlinks "^2.0.0" - test-exclude@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-6.0.0.tgz#04a8698661d805ea6fa293b6cb9e63ac044ef15e"