File tree Expand file tree Collapse file tree 4 files changed +29
-5
lines changed Expand file tree Collapse file tree 4 files changed +29
-5
lines changed Original file line number Diff line number Diff line change @@ -90,13 +90,15 @@ jobs:
9090
9191 - name : Run tests for webpack version ${{ matrix.webpack-version }}
9292 run : npm run test:coverage -- --ci
93+ env :
94+ EXPERIMENTAL_USE_IMPORT_MODULE : " false"
9395
9496 - name : Submit coverage data to codecov
9597 uses : codecov/codecov-action@v1
9698 with :
9799 token : ${{ secrets.CODECOV_TOKEN }}
98100
99- test2 :
101+ test-new-api :
100102 name : Test - ${{ matrix.os }} - Node v${{ matrix.node-version }}, Webpack latest, experimentalUseImportModule
101103
102104 strategy :
Original file line number Diff line number Diff line change @@ -9,6 +9,8 @@ import webpack from "webpack";
99
1010import Self from "../src/index" ;
1111
12+ import yn from "./helpers/yn" ;
13+
1214function clearDirectory ( dirPath ) {
1315 let files ;
1416
@@ -128,9 +130,12 @@ describe("TestCases", () => {
128130 config . plugins . map ( ( p ) => {
129131 if ( p . constructor === Self ) {
130132 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+ ) ;
133137 }
138+
134139 return p ;
135140 } ) ,
136141 } ,
@@ -192,7 +197,9 @@ describe("TestCases", () => {
192197 const expectedDirectoryByVersion = path . join (
193198 expectedDirectory ,
194199 `webpack-${ webpack . version [ 0 ] } ${
195- process . env . EXPERIMENTAL_USE_IMPORT_MODULE ? "-importModule" : ""
200+ yn ( process . env . EXPERIMENTAL_USE_IMPORT_MODULE )
201+ ? "-importModule"
202+ : ""
196203 } `
197204 ) ;
198205
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