-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: transform file paths into hyperlinks (#8980)
* feat: transform file paths into hyperlinks * chore: commit yarn.lock * chore: update CHANGELOG.md * chore: add test * chore: add test for the returned value * Apply the review suggestions * Hardcode expected values
- Loading branch information
1 parent
309d95a
commit 01fd3a4
Showing
5 changed files
with
67 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
packages/jest-reporters/src/__tests__/get_result_header.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/** | ||
* 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'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters