Files
TS-CUCUMBER-WDIO-QK/test/unit/run-profile.test.mjs
isopropilick 29899223e4
Some checks failed
CI / validate (push) Has been cancelled
Enhance CI configuration and documentation; add new action palette adapter
2026-09-15 10:32:11 -06:00

25 lines
1.0 KiB
JavaScript

import assert from 'node:assert/strict';
import test from 'node:test';
import { executeAndReport } from '../../scripts/run-profile.mjs';
test('builds the report after both passing and failing runs, preserving runner status', async () => {
for (const code of [0, 1, 7]) {
const events = [];
const result = await executeAndReport(async () => { events.push('runner'); return code; }, async () => { events.push('report'); });
assert.equal(result, code);
assert.deepEqual(events, ['runner', 'report']);
}
});
test('attempts reporting after runner startup failure', async () => {
let reported = false;
assert.equal(await executeAndReport(async () => { throw new Error('spawn failed'); }, () => { reported = true; }), 1);
assert.ok(reported);
});
test('a report failure cannot convert a failed runner to success or hide its exit code', async () => {
for (const code of [0, 7]) {
assert.equal(await executeAndReport(async () => code, () => { throw new Error('unwritable report'); }), code || 1);
}
});