Skip to content

Commit 76027d8

Browse files
authored
test: split test-esm-wasm.js
The test has been flaking due to either timeout or calling uv_async_send on a closing/closed handle. As the test squeezes too many independent test cases in one file, split it up to avoid timing out on slower machines and aid debugging. PR-URL: #60491 Refs: https://github.com/nodejs/reliability/blob/main/reports/2025-10-29.md Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent cfa11ba commit 76027d8

File tree

40 files changed

+481
-476
lines changed

40 files changed

+481
-476
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Test that import names are properly escaped
2+
import '../common/index.mjs';
3+
import { spawnSyncAndAssert } from '../common/child_process.js';
4+
import * as fixtures from '../common/fixtures.js';
5+
6+
spawnSyncAndAssert(
7+
process.execPath,
8+
['--no-warnings', fixtures.path('es-modules/test-wasm-escape-import-names.mjs')],
9+
{ stdout: '', stderr: '', trim: true }
10+
);
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Test that all WebAssembly global types are properly handled
2+
import '../common/index.mjs';
3+
import { spawnSyncAndAssert } from '../common/child_process.js';
4+
import * as fixtures from '../common/fixtures.js';
5+
6+
spawnSyncAndAssert(
7+
process.execPath,
8+
['--no-warnings', fixtures.path('es-modules/test-wasm-globals-all-types.mjs')],
9+
{ stdout: '', stderr: '', trim: true }
10+
);
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Test that js-string builtins are supported
2+
import '../common/index.mjs';
3+
import { spawnSyncAndAssert } from '../common/child_process.js';
4+
import * as fixtures from '../common/fixtures.js';
5+
6+
spawnSyncAndAssert(
7+
process.execPath,
8+
['--no-warnings', fixtures.path('es-modules/test-wasm-js-string-builtins.mjs')],
9+
{ stdout: '', stderr: '', trim: true }
10+
);
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Test that WASM modules can load and export functions correctly
2+
import '../common/index.mjs';
3+
import { spawnSyncAndAssert } from '../common/child_process.js';
4+
import * as fixtures from '../common/fixtures.js';
5+
6+
spawnSyncAndAssert(
7+
process.execPath,
8+
['--no-warnings', fixtures.path('es-modules/test-wasm-load-exports.mjs')],
9+
{ stdout: '', stderr: '', trim: true }
10+
);
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Test that experimental warning is emitted for WASM module instances
2+
import '../common/index.mjs';
3+
import assert from 'node:assert';
4+
5+
import { spawnSyncAndAssert } from '../common/child_process.js';
6+
import * as fixtures from '../common/fixtures.js';
7+
8+
spawnSyncAndAssert(
9+
process.execPath,
10+
[fixtures.path('es-modules/wasm-modules.mjs')],
11+
{
12+
stderr(output) {
13+
assert.match(output, /ExperimentalWarning/);
14+
assert.match(output, /Importing WebAssembly module instances/);
15+
}
16+
}
17+
);
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Test that code injection through export names is not allowed
2+
import '../common/index.mjs';
3+
import { spawnSyncAndAssert } from '../common/child_process.js';
4+
import * as fixtures from '../common/fixtures.js';
5+
6+
spawnSyncAndAssert(
7+
process.execPath,
8+
['--no-warnings', fixtures.path('es-modules/export-name-code-injection.wasm')],
9+
{ stdout: '', stderr: '', trim: true }
10+
);
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Test that WASM modules can have non-identifier export names
2+
import '../common/index.mjs';
3+
import { spawnSyncAndAssert } from '../common/child_process.js';
4+
import * as fixtures from '../common/fixtures.js';
5+
6+
spawnSyncAndAssert(
7+
process.execPath,
8+
['--no-warnings', fixtures.path('es-modules/test-wasm-non-identifier-exports.mjs')],
9+
{ stdout: '', stderr: '', trim: true }
10+
);
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Test WASM module with invalid export name starting with 'wasm:'
2+
import '../common/index.mjs';
3+
import { spawnSyncAndAssert } from '../common/child_process.js';
4+
import * as fixtures from '../common/fixtures.js';
5+
6+
spawnSyncAndAssert(
7+
process.execPath,
8+
['--no-warnings', fixtures.path('es-modules/test-wasm-reject-wasm-export-names.mjs')],
9+
{ status: 1, stderr: /Invalid Wasm export/ }
10+
);
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Test WASM module with invalid import name starting with 'wasm:'
2+
import '../common/index.mjs';
3+
import { spawnSyncAndAssert } from '../common/child_process.js';
4+
import * as fixtures from '../common/fixtures.js';
5+
6+
spawnSyncAndAssert(
7+
process.execPath,
8+
['--no-warnings', fixtures.path('es-modules/test-wasm-reject-wasm-import-names.mjs')],
9+
{ status: 1, stderr: /Invalid Wasm import name/ }
10+
);
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Test WASM module with invalid export name starting with 'wasm-js:'
2+
import '../common/index.mjs';
3+
import { spawnSyncAndAssert } from '../common/child_process.js';
4+
import * as fixtures from '../common/fixtures.js';
5+
6+
spawnSyncAndAssert(
7+
process.execPath,
8+
['--no-warnings', fixtures.path('es-modules/test-wasm-reject-wasm-js-export-names.mjs')],
9+
{ status: 1, stderr: /Invalid Wasm export/ }
10+
);

0 commit comments

Comments
 (0)