Files
orca/config/scripts/vitest-node-runtime-worker.mjs
T
Neil 3ec38b8c6d Run Vitest on Bun with Node runtime contracts (#25840)
* Run Vitest on Bun while preserving Node runtime contracts

* Preserve runtime timing provenance and keep the Bun pin in config

* Scope builtin compatibility mocks to test-only lint exceptions

* Give capture retention fixtures distinct filesystem timestamps

* Await the copy button success state in the React fixture

* Bound Node test worker shutdown and tighten migration fixtures
2026-10-06 03:18:06 -07:00

21 lines
761 B
JavaScript

import { parse, stringify } from 'devalue'
import { init, runBaseTests, setupEnvironment } from 'vitest/worker'
if (!process.send) {
throw new Error('Node Vitest worker requires an IPC channel')
}
const send = process.send.bind(process)
// Preserve RegExp filters and cyclic test results across Bun/Node's JSON-only IPC boundary.
init({
post: (response) => send(response),
on: (callback) => process.on('message', callback),
off: (callback) => process.off('message', callback),
serialize: stringify,
deserialize: parse,
teardown: () => process.removeAllListeners('message'),
runTests: (state, traces) => runBaseTests('run', state, traces),
collectTests: (state, traces) => runBaseTests('collect', state, traces),
setup: setupEnvironment
})