@@ -20,10 +20,12 @@ describe('runs codemods', function() {
2020 this . timeout ( 5 * 60 * 1000 ) ;
2121
2222 let tmpPath ;
23+ let applicableCodemods ;
2324
2425 async function merge ( {
2526 fixturesPath,
2627 commitMessage,
28+ statsOnly,
2729 beforeMerge = ( ) => Promise . resolve ( )
2830 } ) {
2931 tmpPath = await buildTmp ( {
@@ -35,7 +37,7 @@ describe('runs codemods', function() {
3537 return processBin ( {
3638 bin : 'ember-cli-update' ,
3739 args : [
38- '--run-codemods' ,
40+ statsOnly ? '--stats-only' : '--run-codemods' ,
3941 `--codemods-json='${ JSON . stringify ( manifest ) } '`
4042 ] ,
4143 cwd : tmpPath ,
@@ -57,12 +59,43 @@ describe('runs codemods', function() {
5759 } ) ;
5860 }
5961
60- // eslint-disable-next-line mocha/no-setup-in-describe
61- for ( let i = 0 ; i < codemods . length ; i ++ ) {
62- // eslint-disable-next-line mocha/no-setup-in-describe
63- let codemod = codemods [ i ] ;
62+ async function getApplicableCodemods ( ) {
63+ let {
64+ ps,
65+ promise
66+ } = await merge ( {
67+ fixturesPath : 'test/fixtures/local' ,
68+ commitMessage : 'my-app' ,
69+ statsOnly : true
70+ } ) ;
71+
72+ ps . stdout . pipe ( process . stdout ) ;
73+
74+ let stdout = '' ;
75+
76+ ps . stdout . on ( 'data' , data => {
77+ stdout += data . toString ( ) ;
78+ } ) ;
79+
80+ await promise ;
6481
82+ let applicableCodemods = stdout . match ( / ^ a p p l i c a b l e c o d e m o d s : ( .+ ) $ / m) [ 1 ] . split ( ', ' ) ;
83+
84+ return applicableCodemods ;
85+ }
86+
87+ // eslint-disable-next-line mocha/no-hooks-for-single-case
88+ beforeEach ( async function ( ) {
89+ applicableCodemods = await getApplicableCodemods ( ) ;
90+ } ) ;
91+
92+ for ( let codemod of codemods ) {
6593 it ( codemod , async function ( ) {
94+ if ( ! applicableCodemods . includes ( codemod ) ) {
95+ this . skip ( ) ;
96+ return ;
97+ }
98+
6699 async function _merge ( src , dest ) {
67100 await fs . copy (
68101 path . join ( __dirname , `fixtures/codemods/${ codemod } /${ src } /my-app` ) ,
@@ -93,6 +126,7 @@ describe('runs codemods', function() {
93126 let down = '\u001b[B' ;
94127 let space = ' ' ;
95128 let enter = '\n' ;
129+ let i = applicableCodemods . indexOf ( codemod ) ;
96130 ps . stdin . write ( `${ down . repeat ( i ) } ${ space } ${ enter } ` ) ;
97131
98132 ps . stdout . removeListener ( 'data' , stdoutData ) ;
0 commit comments