@@ -449,18 +449,6 @@ test('putout: cli: ide: web storm', async (t) => {
449449 createCache,
450450 } ) ;
451451
452- const simpleImport = async ( url ) => {
453- if ( url === './exit.mjs' )
454- return await import ( url ) ;
455-
456- if ( url . includes ( 'processor' ) )
457- return await import ( url ) ;
458- } ;
459-
460- mockRequire ( './simple-import.js' , {
461- simpleImport,
462- } ) ;
463-
464452 reRequire ( './runner/writer.js' ) ;
465453 reRequire ( './runner/runner.js' ) ;
466454 const cli = reRequire ( '.' ) ;
@@ -715,9 +703,17 @@ test('putout: cli: --fresh', async (t) => {
715703 processors : [ 'javascript' ] ,
716704 } ) ;
717705
718- mockRequire ( '@putout/cli-cache' , {
719- createCache,
706+ mockRequire ( './simple-import' , {
707+ simpleImport : async ( url ) => {
708+ if ( url === '@putout/cli-cache' )
709+ return {
710+ createCache,
711+ } ;
712+
713+ return await import ( url ) ;
714+ } ,
720715 } ) ;
716+
721717 mockRequire ( './get-options' , getOptions ) ;
722718
723719 reRequire ( './get-files' ) ;
@@ -965,7 +961,6 @@ test('putout: cli: --fix --staged: exit code', async (t) => {
965961test ( 'putout: cli: --staged --fix' , async ( t ) => {
966962 const logError = stub ( ) ;
967963 const get = stub ( ) . returns ( [ './xxx.js' ] ) ;
968-
969964 const set = stub ( ) . returns ( [ 'hello.txt' ] ) ;
970965
971966 const argv = [
@@ -1017,11 +1012,7 @@ test('putout: cli: ruler: --enable', async (t) => {
10171012 ruler,
10181013 } ;
10191014
1020- if ( url === './exit.mjs' )
1021- return await import ( url ) ;
1022-
1023- if ( url . includes ( 'processor' ) )
1024- return await import ( url ) ;
1015+ return await import ( url ) ;
10251016 } ;
10261017
10271018 mockRequire ( './simple-import' , {
@@ -1059,21 +1050,17 @@ test('putout: cli: ruler: --enable-all', async (t) => {
10591050
10601051 const argv = [ '--enable-all' , __filename ] ;
10611052
1062- const simpleImport = async ( url ) => {
1053+ const _simpleImport = async ( url ) => {
10631054 if ( url . includes ( 'ruler' ) )
10641055 return {
10651056 ruler,
10661057 } ;
10671058
1068- if ( url === './exit.mjs' )
1069- return await import ( url ) ;
1070-
1071- if ( url . includes ( 'processor' ) )
1072- return await import ( url ) ;
1059+ return await import ( url ) ;
10731060 } ;
10741061
10751062 mockRequire ( './simple-import' , {
1076- simpleImport,
1063+ simpleImport : _simpleImport ,
10771064 } ) ;
10781065
10791066 const cli = reRequire ( '.' ) ;
@@ -1099,7 +1086,7 @@ test('putout: cli: ruler processor: --disable-all', async (t) => {
10991086 const rulerError = Error ( 'should call ruler with await' ) ;
11001087 const ruler = stub ( ) . rejects ( rulerError ) ;
11011088
1102- const simpleImport = async ( url ) => {
1089+ const _simpleImport = async ( url ) => {
11031090 if ( url . includes ( 'ruler' ) )
11041091 return {
11051092 ruler,
@@ -1110,10 +1097,12 @@ test('putout: cli: ruler processor: --disable-all', async (t) => {
11101097
11111098 if ( url . includes ( 'processor' ) )
11121099 return await import ( url ) ;
1100+
1101+ return simpleImport ( url ) ;
11131102 } ;
11141103
11151104 mockRequire ( './simple-import' , {
1116- simpleImport,
1105+ simpleImport : _simpleImport ,
11171106 } ) ;
11181107
11191108 const cli = reRequire ( '.' ) ;
@@ -1711,8 +1700,18 @@ test('putout: cli: fileCache: canUseCache', async (t) => {
17111700 } ) ;
17121701
17131702 mockRequire ( './get-options' , getOptions ) ;
1714- mockRequire ( '@putout/cli-cache' , {
1715- createCache,
1703+ //mockRequire('@putout/cli-cache', {
1704+ // createCache,
1705+ //});
1706+ mockRequire ( './simple-import.js' , {
1707+ simpleImport : ( name ) => {
1708+ if ( name === '@putout/cli-cache' )
1709+ return {
1710+ createCache,
1711+ } ;
1712+
1713+ return simpleImport ( name ) ;
1714+ } ,
17161715 } ) ;
17171716
17181717 reRequire ( './runner/writer.js' ) ;
0 commit comments