-
Notifications
You must be signed in to change notification settings - Fork 70
/
Copy pathwebpack-benchmark.test.js
41 lines (37 loc) · 1.09 KB
/
webpack-benchmark.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Copyright 2017 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
const path = require("path");
const webpack = require("webpack");
const webpackConfig = require("../webpack.config.js");
const outputFile = path.resolve(
__dirname,
"..",
"build",
"webpack-benchmark.test.js"
);
let webpackBenchmark;
beforeAll(
() =>
new Promise((resolve, reject) => {
const baseConfig = webpackConfig[0];
const config = Object.assign({}, baseConfig, {
entry: require.resolve("./webpack-benchmark.js")
});
config.output = Object.assign({}, baseConfig.output, {
libraryTarget: "commonjs2",
path: path.dirname(outputFile),
filename: path.basename(outputFile)
});
const compiler = webpack(config);
compiler.run(err => {
if (err) {
reject(err);
return;
}
webpackBenchmark = require(outputFile);
resolve();
});
})
);
it("webpack runs to completion", () => void webpackBenchmark.fn());