Skip to content

Commit

Permalink
[Tests] skip webpack 5 async function test on node <7
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed May 13, 2021
1 parent 3f9dd99 commit ab82094
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions resolvers/webpack/test/externals.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
const chai = require('chai');
const expect = chai.expect;
const path = require('path');
const semver = require('semver');

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

Expand All @@ -12,9 +13,6 @@ describe('externals', function () {
const settingsWebpack5 = {
config: require(path.join(__dirname, './files/webpack.config.webpack5.js')),
};
const settingsWebpack5Async = {
config: require(path.join(__dirname, './files/webpack.config.webpack5.async-externals.js')),
};

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

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

it('prevents using an asynchronous function for webpack 5', function () {
const resolved = webpack.resolve('underscore', file, settingsWebpack5Async());
expect(resolved).to.have.property('found', false);
});

it('prevents using a function which uses Promise returned by getResolve for webpack 5', function () {
const resolved = webpack.resolve('graphql', file, settingsWebpack5Async);
expect(resolved).to.have.property('found', false);
it('prevents using a function which uses Promise returned by getResolve for webpack 5', function () {
const resolved = webpack.resolve('graphql', file, settingsWebpack5Async());
expect(resolved).to.have.property('found', false);
});
});
});

0 comments on commit ab82094

Please sign in to comment.