import test from "node:test";
import assert from "node:assert/strict";
import { execFile } from "node:child_process";
import { promisify } from "node:util";
import { fileURLToPath } from "node:url";

const worker = fileURLToPath(new URL("../support/child-session-resources-sdk-worker.mjs", import.meta.url));

test("real SDK: the auditor and Oracle load the main session's extensions only with project resources on (#196)", { timeout: 60000 }, async () => {
	const { stdout } = await promisify(execFile)(process.execPath, ["--experimental-strip-types", worker], { timeout: 55000 });
	assert.deepEqual(JSON.parse(stdout.trim().split("\n").at(-1)!), { off: 0, on: 1 });
});
