@@ -105,7 +105,7 @@ describe('watch mode - watch flags', { concurrency: !process.env.TEST_PARALLEL,
105105 const watchPath = path . join ( projectDir , 'template.html' ) ;
106106 writeFileSync ( watchPath , '' ) ;
107107
108- async function assertExecArgv ( args , expectedPrefixes ) {
108+ async function assertExecArgv ( args , expectedSubsequences ) {
109109 const { stdout, stderr } = await runNode ( {
110110 args, options : { cwd : projectDir }
111111 } ) ;
@@ -115,15 +115,21 @@ describe('watch mode - watch flags', { concurrency: !process.env.TEST_PARALLEL,
115115 const execArgvLine = stdout [ 0 ] ;
116116 const execArgv = JSON . parse ( execArgvLine ) ;
117117 assert . ok ( Array . isArray ( execArgv ) ) ;
118- const matched = expectedPrefixes . some ( ( expectedPrefix ) => {
119- if ( execArgv . length < expectedPrefix . length ) {
120- return false ;
118+ const matched = expectedSubsequences . some ( ( expectedSeq ) => {
119+ for ( let i = 0 ; i <= execArgv . length - expectedSeq . length ; i ++ ) {
120+ let ok = true ;
121+ for ( let j = 0 ; j < expectedSeq . length ; j ++ ) {
122+ if ( execArgv [ i + j ] !== expectedSeq [ j ] ) {
123+ ok = false ;
124+ break ;
125+ }
126+ }
127+ if ( ok ) return true ;
121128 }
122- return execArgv . slice ( 0 , expectedPrefix . length )
123- . every ( ( value , idx ) => value === expectedPrefix [ idx ] ) ;
129+ return false ;
124130 } ) ;
125131 assert . ok ( matched ,
126- `execArgv (${ execArgv } ) does not start with any expected prefix (${ expectedPrefixes . map ( ( p ) => `[${ p } ]` ) . join ( ', ' ) } )` ) ;
132+ `execArgv (${ execArgv } ) does not contain any expected sequence (${ expectedSubsequences . map ( ( seq ) => `[${ seq } ]` ) . join ( ', ' ) } )` ) ;
127133 assert . match ( stdout . at ( - 1 ) , / ^ C o m p l e t e d r u n n i n g / ) ;
128134 }
129135
0 commit comments