@@ -500,27 +500,48 @@ describe('Functional tests using webpack', function() {
500500 config . enableVersioning ( true ) ;
501501
502502 testSetup . runWebpack ( config , ( webpackAssert ) => {
503- if ( ! process . env . DISABLE_UNSTABLE_CHECKS ) {
504- expect ( config . outputPath ) . to . be . a . directory ( )
505- . with . files ( [
506- '0.90edc8e8.js' , // chunks are also versioned
507- '0.6ba897e2.css' ,
508- 'main.4a5effdb.js' ,
509- 'h1.6ba897e2.css' ,
510- 'bg.76e19b0d.css' ,
511- 'manifest.json' ,
512- 'entrypoints.json' ,
513- 'runtime.7c5b5f14.js' ,
514- ] ) ;
515- }
503+ const actualFilesMap = { } ;
504+ const expectedFiles = [
505+ '0.[hash].js' , // chunks are also versioned
506+ '0.[hash].css' ,
507+ 'main.[hash].js' ,
508+ 'h1.[hash].css' ,
509+ 'bg.[hash].css' ,
510+ 'manifest.json' ,
511+ 'entrypoints.json' ,
512+ 'runtime.[hash].js' ,
513+ ] ;
514+
515+ expect ( config . outputPath ) . to . be . a . directory ( )
516+ . with . files . that . satisfy ( files => {
517+ for ( const expectedFile of expectedFiles ) {
518+ const expectedFileRegexp = new RegExp ( `^${
519+ expectedFile
520+ . replace ( '.' , '\\.' )
521+ . replace ( '[hash]' , '[0-9a-f]+' )
522+ } $`) ;
523+
524+ const matchingFile = files . find ( file => {
525+ return expectedFileRegexp . test ( file ) ;
526+ } ) ;
527+
528+ if ( ! matchingFile ) {
529+ return false ;
530+ }
531+
532+ actualFilesMap [ expectedFile ] = matchingFile ;
533+ }
534+
535+ return true ;
536+ } ) ;
516537
517538 expect ( path . join ( config . outputPath , 'images' ) ) . to . be . a . directory ( )
518539 . with . files ( [
519540 'symfony_logo.ea1ca6f7.png'
520541 ] ) ;
521542
522543 webpackAssert . assertOutputFileContains (
523- 'bg.76e19b0d .css' ,
544+ actualFilesMap [ 'bg.[hash] .css' ] ,
524545 '/build/images/symfony_logo.ea1ca6f7.png'
525546 ) ;
526547
0 commit comments