19 lines
883 B
JavaScript
19 lines
883 B
JavaScript
import { test } from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { mkdtempSync, rmSync } from 'node:fs';
|
|
import { tmpdir } from 'node:os';
|
|
import { join } from 'node:path';
|
|
import { commandRunner } from './publish-installation.mjs';
|
|
|
|
test('publisher timeout terminates descendants that retain output pipes', async () => {
|
|
const logs = mkdtempSync(join(tmpdir(), 'release-process-test-'));
|
|
try {
|
|
const started = Date.now();
|
|
await assert.rejects(commandRunner(logs)(process.execPath, ['-e', `
|
|
require('child_process').spawn(process.execPath, ['-e', 'setTimeout(() => {}, 2500)'], {stdio: 'inherit'});
|
|
setTimeout(() => {}, 2500);
|
|
`], { timeout: 250, quiet: true }));
|
|
assert.ok(Date.now() - started < 1800, 'timeout must not wait for the descendant to exit naturally');
|
|
} finally { rmSync(logs, { recursive: true, force: true }); }
|
|
});
|