Skip to content

Commit 48648f9

Browse files
shabbyrobeskovhus
andcommitted
Simplify test mocking
Co-authored-by: Kenneth Skovhus <skovhus@users.noreply.github.com>
1 parent f576bf5 commit 48648f9

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

server/src/__tests__/linter.test.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,13 @@ describe('linter', () => {
1818
})
1919

2020
it('should set canLint to false when linting fails', async () => {
21-
jest.spyOn(console, 'error').mockImplementation(() => {}) // eslint-disable-line
22-
try {
23-
const linter = new Linter({
24-
executablePath: '77b4d3f6-c87a-11ec-9b62-a3c90f66d29f',
25-
})
26-
expect(await linter.lint(textToDoc(''), [])).toEqual([])
27-
expect(linter.canLint).toBe(false)
28-
} finally {
29-
;(console.error as any).mockRestore()
30-
}
21+
jest.spyOn(console, 'error').mockImplementation()
22+
const executablePath = '77b4d3f6-c87a-11ec-9b62-a3c90f66d29f'
23+
const linter = new Linter({
24+
executablePath,
25+
})
26+
expect(await linter.lint(textToDoc(''), [])).toEqual([])
27+
expect(linter.canLint).toBe(false)
3128
})
3229

3330
it('should lint when shellcheck present', async () => {

0 commit comments

Comments
 (0)