Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ for (const testCase of testCases) {
server.close();
assert.deepStrictEqual(requests, expectedUrls);
const requestLogs = logs.filter((log) => !('error' in log));
const errors = logs.filter((log) => 'error' in log);
// The client may reset a tunnel while the proxy is still relaying
// the upstream's TLS shutdown; that says nothing about the URLs.
const errors = logs.filter((log) => 'error' in log && log.error.code !== 'ECONNRESET');
assert.deepStrictEqual(new Set(requestLogs), expectedProxyLogs);
assert.deepStrictEqual(errors, []);
}));
Expand Down
5 changes: 4 additions & 1 deletion test/fixtures/wasi-preview-1.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ assert.strictEqual(wasiPreview1.wasiImport,
const name = `pthread-${tid}`;
const sab = new SharedArrayBuffer(8 + 8192);
const result = new Int32Array(sab);
// The thread stores 0 once it has loaded or 1 with an error; wait on a
// value neither of them writes so an early notify cannot be missed.
Atomics.store(result, 0, -1);

const workerData = {
name,
Expand Down Expand Up @@ -106,7 +109,7 @@ assert.strictEqual(wasiPreview1.wasiImport,
throw new Error(e);
});

const r = Atomics.wait(result, 0, 0, 1000);
const r = Atomics.wait(result, 0, -1, common.platformTimeout(30_000));
if (r === 'timed-out') {
workers[tid].terminate();
delete workers[tid];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ const server = net
if (err && err.code !== 'ERR_IPC_CHANNEL_CLOSED' &&
err.code !== 'ECONNRESET' &&
err.code !== 'ECONNREFUSED' &&
err.code !== 'EMFILE') {
err.code !== 'EMFILE' &&
err.code !== 'EPIPE') {
throw err;
}
});
Expand Down
21 changes: 11 additions & 10 deletions test/parallel/test-external-memory-reasonable-size.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

const common = require('../common');
const assert = require('assert');
const { spawnSync } = require('child_process');
const { execSync } = require('child_process');
const { totalmem } = require('os');

// The smallest limit V8 accepts is 1 GB, so the child has to allocate more
Expand All @@ -20,14 +20,15 @@ for (const flag of [
'--external-memory-max-reasonable-size=1',
'--external_memory_max_reasonable_size=1',
]) {
const child = spawnSync(process.execPath, [
flag, '-e', 'new Float64Array(150_000_000)',
]);

assert.notStrictEqual(
child.status,
0,
`${flag} was not honored, the child exited cleanly`,
// The child aborts with over a gigabyte resident, so keep it from writing a
// core file; on some hosts that dump alone outlasts the test timeout.
const [cmd, opts] = common.escapePOSIXShell`"${process.execPath}" ${flag} -e "new Float64Array(150_000_000)"`;
assert.throws(
() => execSync(common.isWindows ? cmd : `ulimit -c 0; ${cmd}`, { ...opts, stdio: 'pipe' }),
(err) => {
assert.notStrictEqual(err.status, 0, `${flag} was not honored, the child exited cleanly`);
assert.match(err.stderr.toString(), /kMaxReasonableBytes/);
return true;
},
);
assert.match(child.stderr.toString(), /kMaxReasonableBytes/);
}
28 changes: 12 additions & 16 deletions test/test-runner/test-run-watch-emit-restarted.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Test run({ watch: true }) emits test:watch:restarted when file is updated
import * as common from '../common/index.mjs';
import '../common/index.mjs';
import { run } from 'node:test';
import assert from 'node:assert';
import { writeFileSync } from 'node:fs';
Expand All @@ -11,37 +11,33 @@ import { refreshForTestRunnerWatch, skipIfNoWatch, fixtureContent } from '../com
skipIfNoWatch();
refreshForTestRunnerWatch();

let alreadyDrained = false;
const events = [];
const testWatchRestarted = common.mustCall(1);
let written = false;

const controller = new AbortController();
const stream = run({
cwd: tmpdir.path,
watch: true,
signal: controller.signal,
}).on('data', function({ type }) {
events.push(type);
if (type === 'test:watch:restarted') {
testWatchRestarted();
if (type !== 'test:watch:restarted' && type !== 'test:watch:drained') {
return;
}
if (type === 'test:watch:drained') {
if (alreadyDrained) {
controller.abort();
}
alreadyDrained = true;
events.push(type);
// Watchers with latency (FSEvents) can still report the fixture setup after
// the first run has started, so only a restart after the write below counts.
if (written && type === 'test:watch:drained' && events.at(-2) === 'test:watch:restarted') {
controller.abort();
}
});

await once(stream, 'test:watch:drained');

events.length = 0;
written = true;
writeFileSync(join(tmpdir.path, 'test.js'), fixtureContent['test.js']);

// eslint-disable-next-line no-unused-vars
for await (const _ of stream);

assert.partialDeepStrictEqual(events, [
'test:watch:drained',
'test:watch:restarted',
'test:watch:drained',
]);
assert.deepStrictEqual(events.slice(-2), ['test:watch:restarted', 'test:watch:drained']);
1 change: 0 additions & 1 deletion test/test-runner/test-runner.status
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,3 @@ test-watch-create-isolation-none: SKIP
# https://github.com/nodejs/node/issues/54534#issuecomment-5423551021
test-run-watch-cwd-isolation-none: PASS, FLAKY
test-run-watch-cwd-isolation-none-argv: PASS, FLAKY
test-run-watch-emit-restarted: PASS, FLAKY
7 changes: 0 additions & 7 deletions test/wasi/wasi.status
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,3 @@ test-wasi-getrusage: SKIP
# Unsupported on Windows and Android
test-wasi-readdir: SKIP

[$system==win32 || $system==macos]
# https://github.com/nodejs/node/issues/64226#issuecomment-5423585588
test-wasi-pthread: PASS, FLAKY

[$system==linux]
# https://github.com/nodejs/node/issues/59146
test-wasi-pthread: PASS, FLAKY
Loading