1- const { basename } = require ( 'path' )
21const t = require ( 'tap' )
32const { readdirSync } = require ( 'fs' )
43
@@ -14,15 +13,22 @@ t.test('basic arg parsing stuff', t => {
1413 console . error = ( ...msg ) => ERRS . push ( msg )
1514
1615 const CALLS = [ ]
17- const rimraf = async ( path , opt ) => CALLS . push ( [ 'rimraf' , path , opt ] )
18- const bin = t . mock ( '../dist/cjs/src/bin.js ', {
19- '../dist/cjs/src/index.js' : Object . assign ( rimraf , {
16+ const rimraf = Object . assign (
17+ async ( path , opt ) => CALLS . push ( [ 'rimraf ', path , opt ] ) ,
18+ {
2019 native : async ( path , opt ) => CALLS . push ( [ 'native' , path , opt ] ) ,
2120 manual : async ( path , opt ) => CALLS . push ( [ 'manual' , path , opt ] ) ,
2221 posix : async ( path , opt ) => CALLS . push ( [ 'posix' , path , opt ] ) ,
2322 windows : async ( path , opt ) => CALLS . push ( [ 'windows' , path , opt ] ) ,
2423 moveRemove : async ( path , opt ) => CALLS . push ( [ 'move-remove' , path , opt ] ) ,
25- } ) ,
24+ }
25+ )
26+
27+ const bin = t . mock ( '../dist/cjs/src/bin.js' , {
28+ '../dist/cjs/src/index.js' : {
29+ rimraf,
30+ ...rimraf ,
31+ } ,
2632 } ) . default
2733
2834 t . afterEach ( ( ) => {
@@ -264,7 +270,7 @@ t.test('actually delete something with it', async t => {
264270 const bin = require . resolve ( '../dist/cjs/src/bin.js' )
265271 const { spawnSync } = require ( 'child_process' )
266272 const res = spawnSync ( process . execPath , [ bin , path ] )
267- const { statSync, readdirSync } = require ( 'fs' )
273+ const { statSync } = require ( 'fs' )
268274 t . throws ( ( ) => statSync ( path ) )
269275 t . equal ( res . status , 0 )
270276} )
0 commit comments