@@ -4,11 +4,12 @@ import * as td from 'testdouble';
44import any from '@travi/any' ;
55
66suite ( 'mocha remover' , ( ) => {
7- let remove , canaryExists , removeCanary ;
7+ let remove , canaryExists , removeCanary , configExists , removeConfig ;
88 const projectRoot = any . string ( ) ;
99
1010 setup ( async ( ) => {
1111 ( { remove : removeCanary , test : canaryExists } = await td . replaceEsm ( './canary/index.js' ) ) ;
12+ ( { remove : removeConfig , test : configExists } = await td . replaceEsm ( './configuration/index.js' ) ) ;
1213
1314 ( { default : remove } = ( await import ( './remover.js' ) ) ) ;
1415 } ) ;
@@ -17,10 +18,12 @@ suite('mocha remover', () => {
1718
1819 test ( 'that mocha details are removed from the project' , async ( ) => {
1920 td . when ( canaryExists ( { projectRoot} ) ) . thenResolve ( true ) ;
21+ td . when ( configExists ( { projectRoot} ) ) . thenResolve ( true ) ;
2022
2123 const { dependencies} = await remove ( { projectRoot} ) ;
2224
2325 td . verify ( removeCanary ( { projectRoot} ) ) ;
26+ td . verify ( removeConfig ( { projectRoot} ) ) ;
2427 assert . deepEqual ( dependencies . javascript . remove , [ 'mocha' , 'chai' , 'sinon' ] ) ;
2528 } ) ;
2629
@@ -31,4 +34,12 @@ suite('mocha remover', () => {
3134
3235 td . verify ( removeCanary ( { projectRoot} ) , { times : 0 } ) ;
3336 } ) ;
37+
38+ test ( 'that removing the config file is not attempted if it does not exist' , async ( ) => {
39+ td . when ( configExists ( { projectRoot} ) ) . thenResolve ( false ) ;
40+
41+ await remove ( { projectRoot} ) ;
42+
43+ td . verify ( removeConfig ( { projectRoot} ) , { times : 0 } ) ;
44+ } ) ;
3445} ) ;
0 commit comments