1
1
'use strict' ;
2
2
3
- const fs = require ( 'fs' ) ;
4
- const path = require ( 'path' ) ;
5
3
const acorn = require ( 'acorn' ) ;
6
4
const request = require ( 'supertest' ) ;
7
5
const testServer = require ( '../helpers/test-server' ) ;
@@ -10,31 +8,16 @@ const port = require('../ports-map').bundle;
10
8
const isWebpack5 = require ( '../helpers/isWebpack5' ) ;
11
9
12
10
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' , ( ) => {
33
12
let server ;
34
13
let req ;
35
14
36
15
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
+ ) ;
38
21
req = request ( server . app ) ;
39
22
} ) ;
40
23
0 commit comments