Skip to content

Commit be70a1f

Browse files
committed
feat: remove warnings from get user code frame
1 parent c47fca6 commit be70a1f

File tree

2 files changed

+0
-13
lines changed

2 files changed

+0
-13
lines changed

src/__tests__/get-user-code-frame.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,6 @@ test('it returns only user code frame when node code frames are present afterwar
6969
})
7070

7171
test("it returns empty string if file from code frame can't be read", () => {
72-
const consoleWarnSpy = jest
73-
.spyOn(global.console, 'warn')
74-
.mockImplementationOnce(jest.fn)
75-
7672
// Make fire read purposely fail
7773
fs.readFileSync.mockImplementationOnce(() => {
7874
throw Error()
@@ -83,8 +79,4 @@ test("it returns empty string if file from code frame can't be read", () => {
8379
globalErrorMock.mockImplementationOnce(() => ({stack}))
8480

8581
expect(getUserCodeFrame(stack)).toEqual('')
86-
expect(consoleWarnSpy).toHaveBeenCalledTimes(1)
87-
expect(consoleWarnSpy).toHaveBeenCalledWith(
88-
`Couldn't read file /sample-error/error-example.js for displaying the code frame`,
89-
)
9082
})

src/get-user-code-frame.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ try {
1212
chalk = nodeRequire.call(module, 'chalk')
1313
} catch {
1414
// We're in a browser environment
15-
/* istanbul ignore next */
16-
console.warn(
17-
'Printing the user trace is not supported in a browser environment',
18-
)
1915
}
2016

2117
// frame has the form "at myMethod (location/to/my/file.js:10:2)"
@@ -35,7 +31,6 @@ function getCodeFrame(frame) {
3531
try {
3632
rawFileContents = readFileSync(filename, 'utf-8')
3733
} catch {
38-
console.warn(`Couldn't read file ${filename} for displaying the code frame`)
3934
return ''
4035
}
4136

0 commit comments

Comments
 (0)