Skip to content

Commit ab82094

Browse files
committed
[Tests] skip webpack 5 async function test on node <7
1 parent 3f9dd99 commit ab82094

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

resolvers/webpack/test/externals.js

+14-10
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
const chai = require('chai');
44
const expect = chai.expect;
55
const path = require('path');
6+
const semver = require('semver');
67

78
const webpack = require('../index');
89

@@ -12,9 +13,6 @@ describe('externals', function () {
1213
const settingsWebpack5 = {
1314
config: require(path.join(__dirname, './files/webpack.config.webpack5.js')),
1415
};
15-
const settingsWebpack5Async = {
16-
config: require(path.join(__dirname, './files/webpack.config.webpack5.async-externals.js')),
17-
};
1816

1917
it('works on just a string', function () {
2018
const resolved = webpack.resolve('bootstrap', file);
@@ -52,13 +50,19 @@ describe('externals', function () {
5250
expect(resolved).to.have.property('path', null);
5351
});
5452

55-
it('prevents using an asynchronous function for webpack 5', function () {
56-
const resolved = webpack.resolve('underscore', file, settingsWebpack5Async);
57-
expect(resolved).to.have.property('found', false);
58-
});
53+
(semver.satisfies(process.version, '> 6') ? describe : describe.skip)('async function in webpack 5', function () {
54+
const settingsWebpack5Async = () => ({
55+
config: require(path.join(__dirname, './files/webpack.config.webpack5.async-externals.js')),
56+
});
57+
58+
it('prevents using an asynchronous function for webpack 5', function () {
59+
const resolved = webpack.resolve('underscore', file, settingsWebpack5Async());
60+
expect(resolved).to.have.property('found', false);
61+
});
5962

60-
it('prevents using a function which uses Promise returned by getResolve for webpack 5', function () {
61-
const resolved = webpack.resolve('graphql', file, settingsWebpack5Async);
62-
expect(resolved).to.have.property('found', false);
63+
it('prevents using a function which uses Promise returned by getResolve for webpack 5', function () {
64+
const resolved = webpack.resolve('graphql', file, settingsWebpack5Async());
65+
expect(resolved).to.have.property('found', false);
66+
});
6367
});
6468
});

0 commit comments

Comments
 (0)