Skip to content

Commit 2d3f477

Browse files
ci: add Node.js 24 (#1136)
1 parent 9642a3a commit 2d3f477

File tree

3 files changed

+21
-21
lines changed

3 files changed

+21
-21
lines changed

.github/workflows/nodejs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ jobs:
6767
strategy:
6868
matrix:
6969
os: [ubuntu-latest, windows-latest, macos-latest]
70-
node-version: [12.x, 14.x, 16.x, 18.x, 20.x, 22.x]
70+
node-version: [12.x, 14.x, 16.x, 18.x, 20.x, 22.x, 24.x]
7171
webpack-version: [latest]
7272

7373
runs-on: ${{ matrix.os }}
@@ -127,7 +127,7 @@ jobs:
127127
strategy:
128128
matrix:
129129
os: [ubuntu-latest, windows-latest, macos-latest]
130-
node-version: [12.x, 14.x, 16.x, 18.x, 20.x, 22.x]
130+
node-version: [12.x, 14.x, 16.x, 18.x, 20.x, 22.x, 24.x]
131131

132132
runs-on: ${{ matrix.os }}
133133

test/TestCases.test.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,19 @@ function clearDirectory(dirPath) {
2323
for (let i = 0; i < files.length; i++) {
2424
const filePath = `${dirPath}/${files[i]}`;
2525

26-
if (fs.statSync(filePath).isFile()) {
26+
if (fs.existsSync(filePath) && fs.statSync(filePath).isFile()) {
2727
fs.unlinkSync(filePath);
2828
} else {
2929
clearDirectory(filePath);
3030
}
3131
}
3232
}
3333

34-
fs.rmdirSync(dirPath);
34+
try {
35+
fs.rmdirSync(dirPath);
36+
} catch (_err) {
37+
// Nothing
38+
}
3539
}
3640

3741
function compareDirectory(actual, expected) {

test/emit-option.test.js

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -315,42 +315,38 @@ describe("emit option", () => {
315315

316316
await del([outputPath]);
317317

318-
const compiler1 = webpack(webpackConfig);
318+
const compiler = webpack(webpackConfig);
319319

320320
await new Promise((resolve, reject) => {
321-
compiler1.run((error, stats) => {
321+
compiler.run((error, stats) => {
322322
if (error) {
323323
reject(error);
324324

325325
return;
326326
}
327327

328-
compiler1.close(() => {
329-
expect(Object.keys(stats.compilation.assets).sort()).toMatchSnapshot(
330-
`assets`
331-
);
332-
expect(
333-
Array.from(stats.compilation.emittedAssets).sort()
334-
).toMatchSnapshot(`emittedAssets`);
335-
expect(getWarnings(stats)).toMatchSnapshot("warnings");
336-
expect(getErrors(stats)).toMatchSnapshot("errors");
328+
expect(Object.keys(stats.compilation.assets).sort()).toMatchSnapshot(
329+
`assets`
330+
);
331+
expect(
332+
Array.from(stats.compilation.emittedAssets).sort()
333+
).toMatchSnapshot(`emittedAssets`);
334+
expect(getWarnings(stats)).toMatchSnapshot("warnings");
335+
expect(getErrors(stats)).toMatchSnapshot("errors");
337336

338-
resolve();
339-
});
337+
resolve();
340338
});
341339
});
342340

343-
const compiler2 = webpack(webpackConfig);
344-
345341
await new Promise((resolve, reject) => {
346-
compiler2.run((error, stats) => {
342+
compiler.run((error, stats) => {
347343
if (error) {
348344
reject(error);
349345

350346
return;
351347
}
352348

353-
compiler2.close(() => {
349+
compiler.close(() => {
354350
expect(Object.keys(stats.compilation.assets).sort()).toMatchSnapshot(
355351
`assets`
356352
);

0 commit comments

Comments
 (0)