11import { posix , win32 } from 'node:path' ;
2+ import { stripVTControlCharacters } from 'node:util' ;
23
3- import strip from 'strip-ansi' ;
44import { describe , expect , test , vi } from 'vitest' ;
55
66import type { TraceResult } from '../application.mjs' ;
@@ -17,7 +17,7 @@ describe('traceEmitter', () => {
1717 dictionaryPathFormat : 'long' ,
1818 iPath : posix ,
1919 } ) ;
20- expect ( strip ( report . table ) ) . toEqual ( 'Word F Dictionary Dictionary Location' ) ;
20+ expect ( stripVTControlCharacters ( report . table ) ) . toEqual ( 'Word F Dictionary Dictionary Location' ) ;
2121 } ) ;
2222
2323 test ( 'posix format long' , ( ) => {
@@ -28,7 +28,7 @@ describe('traceEmitter', () => {
2828 dictionaryPathFormat : 'long' ,
2929 iPath : posix ,
3030 } ) ;
31- const lines = report . table . split ( '\n' ) . map ( strip ) ;
31+ const lines = report . table . split ( '\n' ) . map ( stripVTControlCharacters ) ;
3232 expect ( lines . reduce ( ( a , b ) => Math . max ( a , b . length ) , 0 ) ) . toBeLessThanOrEqual ( lineWidth ) ;
3333 const output = lines . join ( '\n' ) ;
3434 expect ( output ) . toEqual ( `\
@@ -42,7 +42,7 @@ errorcode - softwareTerms* node_modules/@cspell/.../dict/softwareTerms.txt`)
4242
4343 test ( 'posix format short' , ( ) => {
4444 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 ) ) ) ;
4646 const lineWidth = 80 ;
4747 emitTraceResults ( 'errorcode' , true , sampleResults ( ) , {
4848 cwd : '/this_is_a_very/long/path' ,
@@ -64,7 +64,7 @@ errorcode - softwareTerms* node_modules/@cspell/.../dict/softwareTerms.txt`)
6464
6565 test ( 'win32 format long' , ( ) => {
6666 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 ) ) ) ;
6868 const lineWidth = 80 ;
6969 emitTraceResults ( 'errorcode' , true , sampleResultsWin32 ( ) , {
7070 cwd : 'D:/this_is_a_very/long/path' ,
@@ -88,7 +88,7 @@ errorcode - softwareTerms* node_modules/@cspell/.../dict/softwareTerms.txt`)
8888
8989 test ( 'win32 format full' , ( ) => {
9090 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 ) ) ) ;
9292 const lineWidth = 80 ;
9393 emitTraceResults ( 'errorcode' , true , sampleResultsWin32 ( ) , {
9494 cwd : 'D:/this_is_a_very/long/path' ,
0 commit comments