Skip to content
This repository was archived by the owner on Jul 27, 2021. It is now read-only.

Commit 2d8936d

Browse files
committed
Fix node 4-5 builds
1 parent c6488de commit 2d8936d

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

test/integration.spec.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
1+
"use strict";
2+
13
const output = require('../src/output');
24
const webpack = require('webpack');
35
const FriendlyErrorsWebpackPlugin = require('../src/friendly-errors-plugin');
46
const MemoryFileSystem = require('memory-fs');
57

6-
const webpackPromise = function(config, ...globalPlugins) {
8+
const webpackPromise = function(config, globalPlugins) {
79
const compiler = webpack(config);
810
compiler.outputFileSystem = new MemoryFileSystem();
9-
globalPlugins.forEach(p => compiler.apply(p));
11+
if (Array.isArray(globalPlugins)) {
12+
globalPlugins.forEach(p => compiler.apply(p));
13+
}
1014

1115
return new Promise((resolve, reject) => {
1216
compiler.run(err => {
@@ -18,10 +22,10 @@ const webpackPromise = function(config, ...globalPlugins) {
1822
});
1923
};
2024

21-
async function executeAndGetLogs(fixture, ...globalPlugins) {
25+
async function executeAndGetLogs(fixture, globalPlugins) {
2226
try {
2327
output.capture();
24-
await webpackPromise(require(fixture), ...globalPlugins);
28+
await webpackPromise(require(fixture), globalPlugins);
2529
return output.capturedMessages;
2630
} finally {
2731
output.endCapture()
@@ -96,15 +100,17 @@ it('integration : babel syntax error', async () => {
96100
it('integration : webpack multi compiler : success', async () => {
97101

98102
// We apply the plugin directly to the compiler when targeting multi-compiler
99-
const logs = await executeAndGetLogs('./fixtures/multi-compiler-success/webpack.config', new FriendlyErrorsWebpackPlugin());
103+
let globalPlugins = [new FriendlyErrorsWebpackPlugin()];
104+
const logs = await executeAndGetLogs('./fixtures/multi-compiler-success/webpack.config', globalPlugins);
100105

101106
expect(logs.join('\n')).toMatch(/DONE Compiled successfully in (.\d*)ms/)
102107
});
103108

104109
it('integration : webpack multi compiler : module-errors', async () => {
105110

106111
// We apply the plugin directly to the compiler when targeting multi-compiler
107-
const logs = await executeAndGetLogs('./fixtures/multi-compiler-module-errors/webpack.config', new FriendlyErrorsWebpackPlugin());
112+
let globalPlugins = [new FriendlyErrorsWebpackPlugin()];
113+
const logs = await executeAndGetLogs('./fixtures/multi-compiler-module-errors/webpack.config', globalPlugins);
108114

109115
expect(logs).toEqual([
110116
' ERROR Failed to compile with 2 errors',

0 commit comments

Comments
 (0)