1
1
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'
3
13
import { colors } from '../src/colors.js'
4
14
import { json , logStream , pretty , prettyTime , twoDigitNumber } from '../src/output_adapters.js'
5
15
@@ -33,10 +43,10 @@ describe('Log Output Adapters', () => {
33
43
} )
34
44
35
45
describe ( 'pretty' , ( ) => {
36
- let writeOutputStub : ReturnType < typeof vi . spyOn >
46
+ let writeOutputStub : MockInstance
37
47
38
48
beforeAll ( ( ) => {
39
- writeOutputStub = vi . spyOn ( logStream , 'write' ) as unknown as ReturnType < typeof vi . spyOn >
49
+ writeOutputStub = vi . spyOn ( logStream , 'write' )
40
50
} )
41
51
42
52
beforeEach ( ( ) => {
@@ -63,10 +73,10 @@ describe('Log Output Adapters', () => {
63
73
} )
64
74
65
75
describe ( 'json' , ( ) => {
66
- let writeOutputStub : ReturnType < typeof vi . spyOn >
76
+ let writeOutputStub : MockInstance
67
77
68
78
beforeAll ( ( ) => {
69
- writeOutputStub = vi . spyOn ( logStream , 'write' ) as unknown as ReturnType < typeof vi . spyOn >
79
+ writeOutputStub = vi . spyOn ( logStream , 'write' )
70
80
} )
71
81
72
82
beforeEach ( ( ) => {
@@ -110,10 +120,10 @@ describe('Log Output Adapters', () => {
110
120
} )
111
121
112
122
describe ( 'logStream' , ( ) => {
113
- let writeSpy : ReturnType < typeof vi . spyOn >
123
+ let writeSpy : MockInstance
114
124
115
125
beforeEach ( ( ) => {
116
- writeSpy = vi . spyOn ( process . stdout , 'write' ) as unknown as ReturnType < typeof vi . spyOn >
126
+ writeSpy = vi . spyOn ( process . stdout , 'write' )
117
127
writeSpy . mockImplementation ( ( ) => { } )
118
128
} )
119
129
0 commit comments