Skip to content

Commit bbef8d2

Browse files
committed
test(3.0): use correct type MockInstance for vi.spyOn
1 parent 42164ed commit bbef8d2

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

test/output_adapters.test.ts

+17-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
import prettyOutput from 'prettyoutput'
2-
import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest'
2+
import {
3+
type MockInstance,
4+
afterAll,
5+
afterEach,
6+
beforeAll,
7+
beforeEach,
8+
describe,
9+
expect,
10+
it,
11+
vi,
12+
} from 'vitest'
313
import { colors } from '../src/colors.js'
414
import { json, logStream, pretty, prettyTime, twoDigitNumber } from '../src/output_adapters.js'
515

@@ -33,10 +43,10 @@ describe('Log Output Adapters', () => {
3343
})
3444

3545
describe('pretty', () => {
36-
let writeOutputStub: ReturnType<typeof vi.spyOn>
46+
let writeOutputStub: MockInstance
3747

3848
beforeAll(() => {
39-
writeOutputStub = vi.spyOn(logStream, 'write') as unknown as ReturnType<typeof vi.spyOn>
49+
writeOutputStub = vi.spyOn(logStream, 'write')
4050
})
4151

4252
beforeEach(() => {
@@ -63,10 +73,10 @@ describe('Log Output Adapters', () => {
6373
})
6474

6575
describe('json', () => {
66-
let writeOutputStub: ReturnType<typeof vi.spyOn>
76+
let writeOutputStub: MockInstance
6777

6878
beforeAll(() => {
69-
writeOutputStub = vi.spyOn(logStream, 'write') as unknown as ReturnType<typeof vi.spyOn>
79+
writeOutputStub = vi.spyOn(logStream, 'write')
7080
})
7181

7282
beforeEach(() => {
@@ -110,10 +120,10 @@ describe('Log Output Adapters', () => {
110120
})
111121

112122
describe('logStream', () => {
113-
let writeSpy: ReturnType<typeof vi.spyOn>
123+
let writeSpy: MockInstance
114124

115125
beforeEach(() => {
116-
writeSpy = vi.spyOn(process.stdout, 'write') as unknown as ReturnType<typeof vi.spyOn>
126+
writeSpy = vi.spyOn(process.stdout, 'write')
117127
writeSpy.mockImplementation(() => {})
118128
})
119129

0 commit comments

Comments
 (0)