Skip to content

Commit e64c006

Browse files
committed
test: don't test against webpack 4 on node 18
webpack 4 doesn't support node 18
1 parent 39961aa commit e64c006

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

index.test.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,18 @@ test.serial("backward-compatibility-pre-1.1.2-config-cjs", async t => {
3838
t.pass();
3939
});
4040

41-
test.serial("webpack-4-compatibility-type-module", async t => {
41+
const nodeMajorVersion = parseInt(process.versions.node.split(".")[0] ?? "", 10);
42+
43+
test("nodeVersion", t => t.is(nodeMajorVersion, 16));
44+
45+
const testSerialIfNodeLessThan17 = nodeMajorVersion < 17 ? test.serial : test.serial.skip;
46+
47+
testSerialIfNodeLessThan17("webpack-4-compatibility-type-module", async t => {
4248
await buildTestProject("test-projects/webpack-4-compatibility-type-module");
4349
t.pass();
4450
});
4551

46-
test.serial("webpack-4-compatibility-type-commonjs", async t => {
52+
testSerialIfNodeLessThan17("webpack-4-compatibility-type-commonjs", async t => {
4753
await buildTestProject("test-projects/webpack-4-compatibility-type-commonjs");
4854
t.pass();
4955
});

tsconfig.test.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"extends": ".",
33
"compilerOptions": {
4-
"noEmit": true
4+
"noEmit": true,
5+
"types": ["node"]
56
},
67
"exclude": []
78
}

0 commit comments

Comments
 (0)