Skip to content

Commit 5e3aff9

Browse files
committed
Remove "done" usages from test/persistent-cache/* tests files
1 parent a5e1a97 commit 5e3aff9

File tree

3 files changed

+40
-36
lines changed

3 files changed

+40
-36
lines changed

test/helpers/assert.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99

1010
'use strict';
1111

12-
const path = require('path');
13-
const fs = require('fs');
14-
const chai = require('chai');
15-
const expect = chai.expect;
16-
const regexEscaper = require('../../lib/utils/regexp-escaper');
12+
import { expect } from 'vitest'
13+
import path from "path";
14+
import fs from "fs";
15+
16+
import regexEscaper from "../../lib/utils/regexp-escaper.js";
1717

1818
const loadManifest = function(webpackConfig) {
1919
return JSON.parse(
@@ -275,6 +275,6 @@ class Assert {
275275
}
276276
}
277277

278-
module.exports = function(webpackConfig) {
278+
export default function(webpackConfig) {
279279
return new Assert(webpackConfig);
280280
};

test/helpers/setup.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const fs = require('fs-extra');
1717
const httpServer = require('http-server');
1818
const configGenerator = require('../../lib/config-generator');
1919
const validator = require('../../lib/config/validator');
20-
const assertUtil = require('./assert');
20+
const assertUtil = require('./assert').default;
2121

2222
const tmpDir = path.join(__dirname, '../', '../', 'test_tmp');
2323
const testFixturesDir = path.join(__dirname, '../', '../', 'fixtures');

test/persistent-cache/functional.test.js

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
'use strict';
1111

12-
import { describe, it, expect, chai } from 'vitest';
12+
import { describe, it, chai } from 'vitest';
1313
chai.use(require('chai-fs'));
1414
chai.use(require('chai-subset'));
1515
const path = require('path');
@@ -35,25 +35,27 @@ function createWebpackConfig(outputDirName = '', testName, command, argv = {}) {
3535

3636
describe('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

Comments
 (0)