@@ -12,7 +12,7 @@ const ROOT = process.cwd();
1212QUnit . module ( 'codemod-cli' , function ( hooks ) {
1313 let codemodProject ;
1414
15- function setupProject ( hooks ) {
15+ function setupProject ( hooks , installDeps = false ) {
1616 let sharedProject ;
1717
1818 hooks . before ( async function ( ) {
@@ -24,13 +24,22 @@ QUnit.module('codemod-cli', function(hooks) {
2424 process . chdir ( ROOT ) ;
2525 } ) ;
2626
27- hooks . beforeEach ( function ( ) {
27+ hooks . beforeEach ( async function ( ) {
2828 codemodProject . copy ( sharedProject . path ( 'test-project' ) ) ;
2929
30+ const jestPath = `${ codemodProject . path ( ) } /node_modules/jest` ;
31+ const codemodCliPath = `${ codemodProject . path ( ) } /node_modules/codemod-cli` ;
32+
33+ if ( installDeps ) {
34+ await execa ( 'yarn' ) ;
35+ fs . removeSync ( jestPath ) ;
36+ fs . removeSync ( codemodCliPath ) ;
37+ }
38+
3039 // setup required dependencies in the project
3140 fs . ensureDirSync ( `${ codemodProject . path ( ) } /node_modules` ) ;
32- fs . symlinkSync ( `${ ROOT } /node_modules/jest` , ` ${ codemodProject . path ( ) } /node_modules/jest` ) ;
33- fs . symlinkSync ( PROJECT_ROOT , ` ${ codemodProject . path ( ) } /node_modules/codemod-cli` ) ;
41+ fs . symlinkSync ( `${ ROOT } /node_modules/jest` , jestPath ) ;
42+ fs . symlinkSync ( PROJECT_ROOT , codemodCliPath ) ;
3443 } ) ;
3544 }
3645
@@ -72,11 +81,7 @@ QUnit.module('codemod-cli', function(hooks) {
7281 } ) ;
7382
7483 QUnit . module ( 'linting' , function ( hooks ) {
75- setupProject ( hooks ) ;
76-
77- hooks . beforeEach ( async function ( ) {
78- await execa ( 'yarn' ) ;
79- } ) ;
84+ setupProject ( hooks , true ) ;
8085
8186 QUnit . test ( 'should pass for a basic project' , async function ( assert ) {
8287 let result = await execa ( 'yarn' , [ 'lint' ] ) ;
0 commit comments