diff --git a/test/client-proxy/test-https-proxy-request-invalid-char-in-url.mjs b/test/client-proxy/test-https-proxy-request-invalid-char-in-url.mjs index 888137b9a5a6..6f27f0775aee 100644 --- a/test/client-proxy/test-https-proxy-request-invalid-char-in-url.mjs +++ b/test/client-proxy/test-https-proxy-request-invalid-char-in-url.mjs @@ -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, []); })); diff --git a/test/fixtures/wasi-preview-1.js b/test/fixtures/wasi-preview-1.js index 535bc3e5ec18..3fde5a30b759 100644 --- a/test/fixtures/wasi-preview-1.js +++ b/test/fixtures/wasi-preview-1.js @@ -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, @@ -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]; diff --git a/test/parallel/test-child-process-fork-closed-channel-segfault.js b/test/parallel/test-child-process-fork-closed-channel-segfault.js index 73bd118ddce3..2f57ab8984dc 100644 --- a/test/parallel/test-child-process-fork-closed-channel-segfault.js +++ b/test/parallel/test-child-process-fork-closed-channel-segfault.js @@ -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; } }); diff --git a/test/parallel/test-external-memory-reasonable-size.js b/test/parallel/test-external-memory-reasonable-size.js index 14e2573328ba..f9ff1af8e5a1 100644 --- a/test/parallel/test-external-memory-reasonable-size.js +++ b/test/parallel/test-external-memory-reasonable-size.js @@ -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 @@ -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/); } diff --git a/test/test-runner/test-run-watch-emit-restarted.mjs b/test/test-runner/test-run-watch-emit-restarted.mjs index 200231c69043..fd596bd818ca 100644 --- a/test/test-runner/test-run-watch-emit-restarted.mjs +++ b/test/test-runner/test-run-watch-emit-restarted.mjs @@ -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'; @@ -11,9 +11,8 @@ 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({ @@ -21,27 +20,24 @@ const stream = run({ 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']); diff --git a/test/test-runner/test-runner.status b/test/test-runner/test-runner.status index 149d6ab689cd..7d2d59d3540c 100644 --- a/test/test-runner/test-runner.status +++ b/test/test-runner/test-runner.status @@ -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 diff --git a/test/wasi/wasi.status b/test/wasi/wasi.status index 14b671b6e3b1..a26617e01367 100644 --- a/test/wasi/wasi.status +++ b/test/wasi/wasi.status @@ -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