1
1
import { posix , win32 } from 'node:path' ;
2
+ import { stripVTControlCharacters } from 'node:util' ;
2
3
3
- import strip from 'strip-ansi' ;
4
4
import { describe , expect , test , vi } from 'vitest' ;
5
5
6
6
import type { TraceResult } from '../application.mjs' ;
@@ -17,7 +17,7 @@ describe('traceEmitter', () => {
17
17
dictionaryPathFormat : 'long' ,
18
18
iPath : posix ,
19
19
} ) ;
20
- expect ( strip ( report . table ) ) . toEqual ( 'Word F Dictionary Dictionary Location' ) ;
20
+ expect ( stripVTControlCharacters ( report . table ) ) . toEqual ( 'Word F Dictionary Dictionary Location' ) ;
21
21
} ) ;
22
22
23
23
test ( 'posix format long' , ( ) => {
@@ -28,7 +28,7 @@ describe('traceEmitter', () => {
28
28
dictionaryPathFormat : 'long' ,
29
29
iPath : posix ,
30
30
} ) ;
31
- const lines = report . table . split ( '\n' ) . map ( strip ) ;
31
+ const lines = report . table . split ( '\n' ) . map ( stripVTControlCharacters ) ;
32
32
expect ( lines . reduce ( ( a , b ) => Math . max ( a , b . length ) , 0 ) ) . toBeLessThanOrEqual ( lineWidth ) ;
33
33
const output = lines . join ( '\n' ) ;
34
34
expect ( output ) . toEqual ( `\
@@ -42,7 +42,7 @@ errorcode - softwareTerms* node_modules/@cspell/.../dict/softwareTerms.txt`)
42
42
43
43
test ( 'posix format short' , ( ) => {
44
44
const consoleLines : string [ ] = [ ] ;
45
- vi . spyOn ( console , 'log' ) . mockImplementation ( ( a ) => consoleLines . push ( strip ( a ) ) ) ;
45
+ vi . spyOn ( console , 'log' ) . mockImplementation ( ( a ) => consoleLines . push ( stripVTControlCharacters ( a ) ) ) ;
46
46
const lineWidth = 80 ;
47
47
emitTraceResults ( 'errorcode' , true , sampleResults ( ) , {
48
48
cwd : '/this_is_a_very/long/path' ,
@@ -64,7 +64,7 @@ errorcode - softwareTerms* node_modules/@cspell/.../dict/softwareTerms.txt`)
64
64
65
65
test ( 'win32 format long' , ( ) => {
66
66
const consoleLines : string [ ] = [ ] ;
67
- vi . spyOn ( console , 'log' ) . mockImplementation ( ( a ) => consoleLines . push ( strip ( a ) ) ) ;
67
+ vi . spyOn ( console , 'log' ) . mockImplementation ( ( a ) => consoleLines . push ( stripVTControlCharacters ( a ) ) ) ;
68
68
const lineWidth = 80 ;
69
69
emitTraceResults ( 'errorcode' , true , sampleResultsWin32 ( ) , {
70
70
cwd : 'D:/this_is_a_very/long/path' ,
@@ -88,7 +88,7 @@ errorcode - softwareTerms* node_modules/@cspell/.../dict/softwareTerms.txt`)
88
88
89
89
test ( 'win32 format full' , ( ) => {
90
90
const lines : string [ ] = [ ] ;
91
- vi . spyOn ( console , 'log' ) . mockImplementation ( ( a ) => lines . push ( strip ( a ) ) ) ;
91
+ vi . spyOn ( console , 'log' ) . mockImplementation ( ( a ) => lines . push ( stripVTControlCharacters ( a ) ) ) ;
92
92
const lineWidth = 80 ;
93
93
emitTraceResults ( 'errorcode' , true , sampleResultsWin32 ( ) , {
94
94
cwd : 'D:/this_is_a_very/long/path' ,
0 commit comments