Skip to content

Commit 581cd98

Browse files
test: fix
1 parent 5f83f18 commit 581cd98

File tree

1 file changed

+6
-23
lines changed

1 file changed

+6
-23
lines changed

test/client/bundle.test.js

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
'use strict';
22

3-
const fs = require('fs');
4-
const path = require('path');
53
const acorn = require('acorn');
64
const request = require('supertest');
75
const testServer = require('../helpers/test-server');
@@ -10,31 +8,16 @@ const port = require('../ports-map').bundle;
108
const isWebpack5 = require('../helpers/isWebpack5');
119

1210
describe('bundle', () => {
13-
// the ES5 check test for the bundle will not work on webpack@5,
14-
// because webpack@5 bundle output uses some ES6 syntax that can
15-
// only be avoided with babel-loader
16-
const runBundleTest = isWebpack5 ? describe.skip : describe;
17-
18-
runBundleTest('index.bundle.js bundled output', () => {
19-
it('should parse with ES5', () => {
20-
const bundleStr = fs.readFileSync(
21-
path.resolve(__dirname, '../../client/default/index.bundle.js'),
22-
'utf8'
23-
);
24-
expect(() => {
25-
acorn.parse(bundleStr, {
26-
ecmaVersion: 5,
27-
});
28-
}).not.toThrow();
29-
});
30-
});
31-
32-
runBundleTest('main.js bundled output', () => {
11+
describe('main.js bundled output', () => {
3312
let server;
3413
let req;
3514

3615
beforeAll((done) => {
37-
server = testServer.start(config, { port }, done);
16+
server = testServer.start(
17+
{ ...config, target: isWebpack5 ? ['es5', 'web'] : 'web' },
18+
{ port },
19+
done
20+
);
3821
req = request(server.app);
3922
});
4023

0 commit comments

Comments
 (0)