99
1010'use strict' ;
1111
12- import { describe , it , expect , chai } from 'vitest' ;
12+ import { describe , it , chai } from 'vitest' ;
1313chai . use ( require ( 'chai-fs' ) ) ;
1414chai . use ( require ( 'chai-subset' ) ) ;
1515const path = require ( 'path' ) ;
@@ -35,25 +35,27 @@ function createWebpackConfig(outputDirName = '', testName, command, argv = {}) {
3535
3636describe ( 'Functional persistent cache tests using webpack' , { repeats : 2 , timeout : 10000 } , function ( ) {
3737 describe ( 'Basic scenarios.' , ( ) => {
38- it ( 'Persistent caching does not cause problems' , ( done ) => {
38+ it ( 'Persistent caching does not cause problems' , async ( ) => {
3939 const config = createWebpackConfig ( 'www/build' , 'basic_cache' , 'dev' ) ;
4040 config . setPublicPath ( '/build' ) ;
4141 config . addEntry ( 'main' , './js/code_splitting' ) ;
4242
43- testSetup . runWebpack ( config , ( webpackAssert ) => {
44- // sanity check
45- webpackAssert . assertManifestPath (
46- 'build/main.js' ,
47- '/build/main.js' ,
48- ) ;
43+ return new Promise ( resolve => {
44+ testSetup . runWebpack ( config , ( webpackAssert ) => {
45+ // sanity check
46+ webpackAssert . assertManifestPath (
47+ 'build/main.js' ,
48+ '/build/main.js' ,
49+ ) ;
4950
50- done ( ) ;
51- } ) ;
51+ resolve ( ) ;
52+ } ) ;
53+ } )
5254 } ) ;
5355 } ) ;
5456
5557 describe ( 'copyFiles() allows to copy files and folders' , ( ) => {
56- it ( 'Persistent caching does not cause problems' , ( done ) => {
58+ it ( 'Persistent caching does not cause problems' , async ( ) => {
5759 const config = createWebpackConfig ( 'www/build' , 'copy_files_cache' , 'production' ) ;
5860 config . addEntry ( 'main' , './js/no_require' ) ;
5961 config . setPublicPath ( '/build' ) ;
@@ -63,27 +65,29 @@ describe('Functional persistent cache tests using webpack', { repeats: 2, timeou
6365 includeSubdirectories : false ,
6466 } ] ) ;
6567
66- testSetup . runWebpack ( config , ( webpackAssert ) => {
67- webpackAssert . assertDirectoryContents ( [
68- 'entrypoints.json' ,
69- 'runtime.[hash:8].js' ,
70- 'main.[hash:8].js' ,
71- 'manifest.json' ,
72- 'symfony_logo.[hash:8].png' ,
73- 'symfony_logo_alt.[hash:8].png' ,
74- ] ) ;
68+ await new Promise ( resolve => {
69+ testSetup . runWebpack ( config , ( webpackAssert ) => {
70+ webpackAssert . assertDirectoryContents ( [
71+ 'entrypoints.json' ,
72+ 'runtime.[hash:8].js' ,
73+ 'main.[hash:8].js' ,
74+ 'manifest.json' ,
75+ 'symfony_logo.[hash:8].png' ,
76+ 'symfony_logo_alt.[hash:8].png' ,
77+ ] ) ;
7578
76- webpackAssert . assertManifestPath (
77- 'build/symfony_logo.png' ,
78- '/build/symfony_logo.91beba37.png' ,
79- ) ;
79+ webpackAssert . assertManifestPath (
80+ 'build/symfony_logo.png' ,
81+ '/build/symfony_logo.91beba37.png' ,
82+ ) ;
8083
81- webpackAssert . assertManifestPath (
82- 'build/symfony_logo_alt.png' ,
83- '/build/symfony_logo_alt.f880ba14.png' ,
84- ) ;
84+ webpackAssert . assertManifestPath (
85+ 'build/symfony_logo_alt.png' ,
86+ '/build/symfony_logo_alt.f880ba14.png' ,
87+ ) ;
8588
86- done ( ) ;
89+ resolve ( ) ;
90+ } ) ;
8791 } ) ;
8892 } ) ;
8993 } ) ;
0 commit comments