Skip to content

Commit c239734

Browse files
ci: fix (#4389)
1 parent dcf4581 commit c239734

File tree

11 files changed

+58
-4
lines changed

11 files changed

+58
-4
lines changed

.cspell.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@
103103
"Zangetsu",
104104
"Zenitsu",
105105
"quickstart",
106-
"pinia"
106+
"pinia",
107+
"watchpack"
107108
],
108109
"dictionaries": ["npm", "software-terms"],
109110
"ignorePaths": [

.github/workflows/nodejs.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -58,10 +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.5.0]
61+
node-version: [18.x, 20.x, 22.x, 23.x]
6262
shard: ["1/4", "2/4", "3/4", "4/4"]
6363
webpack-version: [latest]
6464
dev-server-version: [latest]
65+
exclude:
66+
# Node.js v23.7.0 is broken on windows
67+
- os: windows-latest
68+
node-version: 23.x
6569

6670
steps:
6771
- uses: actions/checkout@v4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"compilerOptions": {
3+
"target": "esnext",
4+
"allowImportingTsExtensions": true,
5+
"rewriteRelativeImportExtensions": true,
6+
"verbatimModuleSyntax": true,
7+
"module": "commonjs"
8+
}
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
const { run } = require("../../../utils/test-utils");
2+
const { existsSync } = require("fs");
3+
const { resolve } = require("path");
4+
5+
describe("webpack cli", () => {
6+
it("should support typescript file", async () => {
7+
// This test is for https://nodejs.org/api/typescript.html#modules-typescript
8+
// By default this feature enabled only since v23.6.0
9+
// For old Node.js version it uses `typescript`
10+
// For v23.6.0+ Node.js version it uses built-in feature
11+
const { exitCode, stderr, stdout } = await run(__dirname, ["-c", "./webpack.config.cts"], {
12+
env: { NODE_NO_WARNINGS: 1 },
13+
});
14+
15+
expect(stderr).toBeFalsy();
16+
expect(stdout).toBeTruthy();
17+
expect(exitCode).toBe(0);
18+
expect(existsSync(resolve(__dirname, "dist/foo.bundle.js"))).toBeTruthy();
19+
});
20+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/* eslint-disable node/no-unsupported-features/es-syntax */
2+
/** eslint-disable **/
3+
const path = require("path");
4+
5+
// cspell:ignore elopment
6+
const mode: string = "dev" + "elopment";
7+
const config = {
8+
mode,
9+
entry: "./main.ts",
10+
output: {
11+
path: path.resolve(__dirname, "dist"),
12+
filename: "foo.bundle.js",
13+
},
14+
};
15+
16+
module.exports = config;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
console.log("Main typescript file");

test/build/config-format/typescript-commonjs/typescript.test.js test/build/config-format/typescript-commonjs-using-typescript/typescript.test.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ const { resolve } = require("path");
44

55
describe("webpack cli", () => {
66
it("should support typescript file", async () => {
7-
const { exitCode, stderr, stdout } = await run(__dirname, ["-c", "./webpack.config.cts"]);
7+
const [major, minor] = process.versions.node.split(".").map(Number);
8+
const { exitCode, stderr, stdout } = await run(__dirname, ["-c", "./webpack.config.cts"], {
9+
nodeOptions: major >= 22 && minor >= 6 ? ["--no-experimental-strip-types"] : [],
10+
});
811

912
expect(stderr).toBeFalsy();
1013
expect(stdout).toBeTruthy();

test/watch/basic/basic.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ describe("basic", () => {
275275
});
276276
});
277277

278-
it("should recompile upon file change using the `command` option and the `--watch` option and log warning", (done) => {
278+
it("should recompile upon file change using the `command` option and the `--watch` option and log warning #2", (done) => {
279279
const proc = runAndGetProcess(__dirname, ["watch", "--no-watch", "--mode", "development"]);
280280

281281
let modified = false;

0 commit comments

Comments
 (0)