1
1
const t = require ( 'tap' )
2
2
const mockNpm = require ( '../../fixtures/mock-npm' )
3
+ const { stripVTControlCharacters } = require ( 'node:util' )
3
4
4
5
const mockOrg = async ( t , { orgSize = 1 , orgList = { } , ...npmOpts } = { } ) => {
5
6
let setArgs = null
@@ -426,8 +427,7 @@ t.test('npm org ls', async t => {
426
427
} ,
427
428
'receieved the correct args'
428
429
)
429
- const { default : stripAnsi } = await import ( 'strip-ansi' )
430
- const out = stripAnsi ( outputs [ 0 ] [ 0 ] )
430
+ const out = stripVTControlCharacters ( outputs [ 0 ] [ 0 ] )
431
431
t . match ( out , / o n e .* d e v e l o p e r / , 'contains the developer member' )
432
432
t . match ( out , / t w o .* a d m i n / , 'contains the admin member' )
433
433
t . match ( out , / t h r e e .* o w n e r / , 'contains the owner member' )
@@ -452,8 +452,7 @@ t.test('npm org ls - user filter', async t => {
452
452
} ,
453
453
'receieved the correct args'
454
454
)
455
- const { default : stripAnsi } = await import ( 'strip-ansi' )
456
- const out = stripAnsi ( outputs [ 0 ] [ 0 ] )
455
+ const out = stripVTControlCharacters ( outputs [ 0 ] [ 0 ] )
457
456
t . match ( out , / u s e r n a m e .* a d m i n / , 'contains the filtered member' )
458
457
t . notMatch ( out , / m i s s i n g .* a d m i n / , 'does not contain other members' )
459
458
} )
@@ -476,8 +475,7 @@ t.test('npm org ls - user filter, missing user', async t => {
476
475
} ,
477
476
'receieved the correct args'
478
477
)
479
- const { default : stripAnsi } = await import ( 'strip-ansi' )
480
- const out = stripAnsi ( outputs [ 0 ] [ 0 ] )
478
+ const out = stripVTControlCharacters ( outputs [ 0 ] [ 0 ] )
481
479
t . notMatch ( out , / u s e r n a m e / , 'does not contain the requested member' )
482
480
t . notMatch ( out , / m i s s i n g .* a d m i n / , 'does not contain other members' )
483
481
} )
0 commit comments