Skip to content

Commit d8ab7a7

Browse files
ci: node.js@24 and rewrite tests
1 parent ac4938a commit d8ab7a7

File tree

30 files changed

+69
-32
lines changed

30 files changed

+69
-32
lines changed

.github/workflows/nodejs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,14 @@ jobs:
5858
strategy:
5959
matrix:
6060
os: [ubuntu-latest, windows-latest, macos-latest]
61-
node-version: [18.x, 20.x, 22.x, 23.x]
61+
node-version: [18.x, 20.x, 22.x, 24.x]
6262
shard: ["1/4", "2/4", "3/4", "4/4"]
6363
webpack-version: [latest]
6464
dev-server-version: [latest]
6565
exclude:
6666
# Node.js v23.7.0 is broken on windows
6767
- os: windows-latest
68-
node-version: 23.x
68+
node-version: 24.x
6969

7070
steps:
7171
- uses: actions/checkout@v4

test/build/config-format/typescript-esnext-mjs/main.ts renamed to test/build/config-format/typescript-cjs-using-nodejs/main.ts

File renamed without changes.

test/build/config-format/typescript-esnext-mjs/package.json renamed to test/build/config-format/typescript-cjs-using-nodejs/package.json

File renamed without changes.

test/build/config-format/typescript-esnext-mjs/tsconfig.json renamed to test/build/config-format/typescript-cjs-using-nodejs/tsconfig.json

File renamed without changes.

test/build/config-format/typescript-commonjs-using-typescript/webpack.config.cts renamed to test/build/config-format/typescript-cjs-using-nodejs/webpack.config.cts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
/* eslint-disable node/no-unsupported-features/es-syntax */
2-
/** eslint-disable **/
3-
import * as path from "path";
2+
const path = require("path");
43

54
// cspell:ignore elopment
65
const mode: string = "dev" + "elopment";
76
const config = {
87
mode,
98
entry: "./main.ts",
109
output: {
11-
path: path.resolve(__dirname, "dist"),
10+
path: path.resolve("dist"),
1211
filename: "foo.bundle.js",
1312
},
1413
};
1514

16-
export = config;
15+
module.exports = config;

test/build/config-format/typescript-commonjs-using-nodejs/tsconfig.json

Lines changed: 0 additions & 9 deletions
This file was deleted.

test/build/config-format/typescript-esnext/main.ts renamed to test/build/config-format/typescript-mjs-using-nodejs/main.ts

File renamed without changes.

test/build/config-format/typescript-esnext/package.json renamed to test/build/config-format/typescript-mjs-using-nodejs/package.json

File renamed without changes.

test/build/config-format/typescript-esnext/tsconfig.json renamed to test/build/config-format/typescript-mjs-using-nodejs/tsconfig.json

File renamed without changes.

test/build/config-format/typescript-esnext-mjs/typescript.test.js renamed to test/build/config-format/typescript-mjs-using-nodejs/typescript.test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ const { resolve } = require("path");
55

66
describe("webpack cli", () => {
77
it("should support typescript esnext file", async () => {
8-
const env = { ...process.env };
9-
8+
const [major, minor] = process.versions.node.split(".").map(Number);
109
const { exitCode, stderr, stdout } = await run(__dirname, ["-c", "./webpack.config.mts"], {
11-
nodeOptions: ["--experimental-loader=ts-node/esm"],
12-
env,
10+
env: { NODE_NO_WARNINGS: 1 },
11+
// Fallback to `ts-node/esm` for old Node.js versions
12+
nodeOptions: major >= 22 && minor >= 6 ? [] : ["--experimental-loader=ts-node/esm"],
1313
});
1414

15-
expect(stderr).not.toBeFalsy(); // Deprecation warning logs on stderr
15+
expect(stderr).toBeFalsy(); // Deprecation warning logs on stderr
1616
expect(stdout).toBeTruthy();
1717
expect(exitCode).toBe(0);
1818
expect(existsSync(resolve(__dirname, "dist/foo.bundle.js"))).toBeTruthy();

0 commit comments

Comments
 (0)