Skip to content

Commit 1ac7e8e

Browse files
committed
Test: Fix tests on Node 6
1 parent 9d2c5f8 commit 1ac7e8e

File tree

1 file changed

+23
-16
lines changed

1 file changed

+23
-16
lines changed

test.js

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,36 +10,43 @@ const getConfig = (options, config = {}) =>
1010
config
1111
);
1212

13-
test('default options', async () => {
14-
const result = await compiler({}, getConfig());
15-
expect(result.compilation.assets['index.html']._value).toMatchSnapshot();
13+
test('default options', () => {
14+
return compiler({}, getConfig()).then(result => {
15+
expect(result.compilation.assets['index.html']._value).toMatchSnapshot();
16+
});
1617
});
1718

18-
test('custom title', async () => {
19-
const result = await compiler({}, getConfig({ context: { title: 'Pizza' } }));
20-
expect(result.compilation.assets['index.html']._value).toMatchSnapshot();
19+
test('custom title', () => {
20+
return compiler({}, getConfig({ context: { title: 'Pizza' } })).then(
21+
result => {
22+
expect(result.compilation.assets['index.html']._value).toMatchSnapshot();
23+
}
24+
);
2125
});
2226

23-
test('custom template', async () => {
24-
const result = await compiler(
27+
test('custom template', () => {
28+
return compiler(
2529
{},
2630
getConfig({
2731
context: { title: 'Pizza' },
2832
template: ({ title }) => `<div>${title}</div>`,
2933
})
30-
);
31-
expect(result.compilation.assets['index.html']._value).toMatchSnapshot();
34+
).then(result => {
35+
expect(result.compilation.assets['index.html']._value).toMatchSnapshot();
36+
});
3237
});
3338

34-
test('custom filename', async () => {
39+
test('custom filename', () => {
3540
const filename = 'pizza.html';
36-
const result = await compiler({}, getConfig({ filename }));
37-
expect(result.compilation.assets[filename]._value).toMatchSnapshot();
41+
return compiler({}, getConfig({ filename })).then(result => {
42+
expect(result.compilation.assets[filename]._value).toMatchSnapshot();
43+
});
3844
});
3945

4046
// TODO: https://github.com/webpack-contrib/test-utils/issues/2
41-
/* test('custom publicPath', async () => {
47+
/* test('custom publicPath', () => {
4248
const publicPath = '/pizza/';
43-
const result = await compiler({}, getConfig({}, { output: { publicPath } }));
44-
expect(result.compilation.assets['index.html']._value).toMatchSnapshot();
49+
return compiler({}, getConfig({}, { output: { publicPath } })).then(result => {
50+
expect(result.compilation.assets['index.html']._value).toMatchSnapshot();
51+
});
4552
}); */

0 commit comments

Comments
 (0)