aboutsummaryrefslogtreecommitdiffstats
path: root/vanilla/node_modules/vitest/dist/chunks/init-forks._y3TW739.js
diff options
context:
space:
mode:
authorAdam Mathes <adam@adammathes.com>2026-02-13 21:34:48 -0800
committerAdam Mathes <adam@adammathes.com>2026-02-13 21:34:48 -0800
commit76cb9c2a39d477a64824a985ade40507e3bbade1 (patch)
tree41e997aa9c6f538d3a136af61dae9424db2005a9 /vanilla/node_modules/vitest/dist/chunks/init-forks._y3TW739.js
parent819a39a21ac992b1393244a4c283bbb125208c69 (diff)
downloadneko-76cb9c2a39d477a64824a985ade40507e3bbade1.tar.gz
neko-76cb9c2a39d477a64824a985ade40507e3bbade1.tar.bz2
neko-76cb9c2a39d477a64824a985ade40507e3bbade1.zip
feat(vanilla): add testing infrastructure and tests (NK-wjnczv)
Diffstat (limited to 'vanilla/node_modules/vitest/dist/chunks/init-forks._y3TW739.js')
-rw-r--r--vanilla/node_modules/vitest/dist/chunks/init-forks._y3TW739.js41
1 files changed, 41 insertions, 0 deletions
diff --git a/vanilla/node_modules/vitest/dist/chunks/init-forks._y3TW739.js b/vanilla/node_modules/vitest/dist/chunks/init-forks._y3TW739.js
new file mode 100644
index 0000000..dd4c7ae
--- /dev/null
+++ b/vanilla/node_modules/vitest/dist/chunks/init-forks._y3TW739.js
@@ -0,0 +1,41 @@
+import { i as init } from './init.B6MLFIaN.js';
+
+if (!process.send) throw new Error("Expected worker to be run in node:child_process");
+// Store globals in case tests overwrite them
+const processExit = process.exit.bind(process);
+const processSend = process.send.bind(process);
+const processOn = process.on.bind(process);
+const processOff = process.off.bind(process);
+const processRemoveAllListeners = process.removeAllListeners.bind(process);
+// Work-around for nodejs/node#55094
+if (process.execArgv.some((execArg) => execArg.startsWith("--prof") || execArg.startsWith("--cpu-prof") || execArg.startsWith("--heap-prof") || execArg.startsWith("--diagnostic-dir"))) processOn("SIGTERM", () => processExit());
+processOn("error", onError);
+function workerInit(options) {
+ const { runTests } = options;
+ init({
+ post: (v) => processSend(v),
+ on: (cb) => processOn("message", cb),
+ off: (cb) => processOff("message", cb),
+ teardown: () => {
+ processRemoveAllListeners("message");
+ processOff("error", onError);
+ },
+ runTests: (state, traces) => executeTests("run", state, traces),
+ collectTests: (state, traces) => executeTests("collect", state, traces),
+ setup: options.setup
+ });
+ async function executeTests(method, state, traces) {
+ try {
+ await runTests(method, state, traces);
+ } finally {
+ process.exit = processExit;
+ }
+ }
+}
+// Prevent leaving worker in loops where it tries to send message to closed main
+// thread, errors, and tries to send the error.
+function onError(error) {
+ if (error?.code === "ERR_IPC_CHANNEL_CLOSED" || error?.code === "EPIPE") processExit(1);
+}
+
+export { workerInit as w };