3
3
const chai = require ( 'chai' ) ;
4
4
const expect = chai . expect ;
5
5
const path = require ( 'path' ) ;
6
+ const semver = require ( 'semver' ) ;
6
7
7
8
const webpack = require ( '../index' ) ;
8
9
@@ -12,9 +13,6 @@ describe('externals', function () {
12
13
const settingsWebpack5 = {
13
14
config : require ( path . join ( __dirname , './files/webpack.config.webpack5.js' ) ) ,
14
15
} ;
15
- const settingsWebpack5Async = {
16
- config : require ( path . join ( __dirname , './files/webpack.config.webpack5.async-externals.js' ) ) ,
17
- } ;
18
16
19
17
it ( 'works on just a string' , function ( ) {
20
18
const resolved = webpack . resolve ( 'bootstrap' , file ) ;
@@ -52,13 +50,19 @@ describe('externals', function () {
52
50
expect ( resolved ) . to . have . property ( 'path' , null ) ;
53
51
} ) ;
54
52
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
+ } ) ;
59
62
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
+ } ) ;
63
67
} ) ;
64
68
} ) ;
0 commit comments