Skip to content

Commit

Permalink
ci: fix (#4389)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait authored Feb 5, 2025
1 parent dcf4581 commit c239734
Show file tree
Hide file tree
Showing 11 changed files with 58 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@
"Zangetsu",
"Zenitsu",
"quickstart",
"pinia"
"pinia",
"watchpack"
],
"dictionaries": ["npm", "software-terms"],
"ignorePaths": [
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,14 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [18.x, 20.x, 22.x, 23.5.0]
node-version: [18.x, 20.x, 22.x, 23.x]
shard: ["1/4", "2/4", "3/4", "4/4"]
webpack-version: [latest]
dev-server-version: [latest]
exclude:
# Node.js v23.7.0 is broken on windows
- os: windows-latest
node-version: 23.x

steps:
- uses: actions/checkout@v4
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"compilerOptions": {
"target": "esnext",
"allowImportingTsExtensions": true,
"rewriteRelativeImportExtensions": true,
"verbatimModuleSyntax": true,
"module": "commonjs"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const { run } = require("../../../utils/test-utils");
const { existsSync } = require("fs");
const { resolve } = require("path");

describe("webpack cli", () => {
it("should support typescript file", async () => {
// This test is for https://nodejs.org/api/typescript.html#modules-typescript
// By default this feature enabled only since v23.6.0
// For old Node.js version it uses `typescript`
// For v23.6.0+ Node.js version it uses built-in feature
const { exitCode, stderr, stdout } = await run(__dirname, ["-c", "./webpack.config.cts"], {
env: { NODE_NO_WARNINGS: 1 },
});

expect(stderr).toBeFalsy();
expect(stdout).toBeTruthy();
expect(exitCode).toBe(0);
expect(existsSync(resolve(__dirname, "dist/foo.bundle.js"))).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/* eslint-disable node/no-unsupported-features/es-syntax */
/** eslint-disable **/
const path = require("path");

// cspell:ignore elopment
const mode: string = "dev" + "elopment";
const config = {
mode,
entry: "./main.ts",
output: {
path: path.resolve(__dirname, "dist"),
filename: "foo.bundle.js",
},
};

module.exports = config;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log("Main typescript file");
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ const { resolve } = require("path");

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

expect(stderr).toBeFalsy();
expect(stdout).toBeTruthy();
Expand Down
2 changes: 1 addition & 1 deletion test/watch/basic/basic.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ describe("basic", () => {
});
});

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

let modified = false;
Expand Down

0 comments on commit c239734

Please # to comment.