File tree 4 files changed +29
-5
lines changed
4 files changed +29
-5
lines changed Original file line number Diff line number Diff line change @@ -90,13 +90,15 @@ jobs:
90
90
91
91
- name : Run tests for webpack version ${{ matrix.webpack-version }}
92
92
run : npm run test:coverage -- --ci
93
+ env :
94
+ EXPERIMENTAL_USE_IMPORT_MODULE : " false"
93
95
94
96
- name : Submit coverage data to codecov
95
97
uses : codecov/codecov-action@v1
96
98
with :
97
99
token : ${{ secrets.CODECOV_TOKEN }}
98
100
99
- test2 :
101
+ test-new-api :
100
102
name : Test - ${{ matrix.os }} - Node v${{ matrix.node-version }}, Webpack latest, experimentalUseImportModule
101
103
102
104
strategy :
Original file line number Diff line number Diff line change @@ -9,6 +9,8 @@ import webpack from "webpack";
9
9
10
10
import Self from "../src/index" ;
11
11
12
+ import yn from "./helpers/yn" ;
13
+
12
14
function clearDirectory ( dirPath ) {
13
15
let files ;
14
16
@@ -128,9 +130,12 @@ describe("TestCases", () => {
128
130
config . plugins . map ( ( p ) => {
129
131
if ( p . constructor === Self ) {
130
132
const { options } = p ;
131
- options . experimentalUseImportModule =
132
- ! ! process . env . EXPERIMENTAL_USE_IMPORT_MODULE ;
133
+
134
+ options . experimentalUseImportModule = yn (
135
+ process . env . EXPERIMENTAL_USE_IMPORT_MODULE
136
+ ) ;
133
137
}
138
+
134
139
return p ;
135
140
} ) ,
136
141
} ,
@@ -192,7 +197,9 @@ describe("TestCases", () => {
192
197
const expectedDirectoryByVersion = path . join (
193
198
expectedDirectory ,
194
199
`webpack-${ webpack . version [ 0 ] } ${
195
- process . env . EXPERIMENTAL_USE_IMPORT_MODULE ? "-importModule" : ""
200
+ yn ( process . env . EXPERIMENTAL_USE_IMPORT_MODULE )
201
+ ? "-importModule"
202
+ : ""
196
203
} `
197
204
) ;
198
205
Original file line number Diff line number Diff line change 1
- module . exports = ( ) => ! process . env . EXPERIMENTAL_USE_IMPORT_MODULE ;
1
+ import yn from "../../helpers/yn" ;
2
+
3
+ module . exports = ( ) => ! yn ( process . env . EXPERIMENTAL_USE_IMPORT_MODULE ) ;
Original file line number Diff line number Diff line change
1
+ function yn ( value , defaultValue = false ) {
2
+ if ( / ^ (?: y | y e s | t r u e | 1 | o n ) $ / i. test ( value ) ) {
3
+ return true ;
4
+ }
5
+
6
+ if ( / ^ (?: n | n o | f a l s e | 0 | o f f ) $ / i. test ( value ) ) {
7
+ return false ;
8
+ }
9
+
10
+ return defaultValue ;
11
+ }
12
+
13
+ module . exports = yn ;
You can’t perform that action at this time.
0 commit comments