diff --git a/harness/src/eshost-elide/agent.elide.js b/harness/src/eshost-elide/agent.elide.js index 9774324..94bad60 100644 --- a/harness/src/eshost-elide/agent.elide.js +++ b/harness/src/eshost-elide/agent.elide.js @@ -124,9 +124,9 @@ class ElideAgent extends ConsoleAgent { // test262 fixture files are ES modules by suite convention, but Elide // (Node-style) treats imported `.js` as CommonJS unless the enclosing // package declares `type: module`. Mark the temp dir accordingly for - // module-flagged tests (whose entry runs as `.mjs`, unaffected by the - // package type); remove the marker for script tests, whose `.js` entry - // must keep evaluating as a classic global script. + // module-flagged tests, whose `.js` entry then parses as ESM; remove the + // marker for script tests, whose `.js` entry must keep evaluating as a + // classic global script. const pkg = path.join(path.dirname(args[0]), "package.json"); try { if (this._elideModule) { diff --git a/harness/src/eshost-elide/agent.test.ts b/harness/src/eshost-elide/agent.test.ts index 88cfc63..dbed3ff 100644 --- a/harness/src/eshost-elide/agent.test.ts +++ b/harness/src/eshost-elide/agent.test.ts @@ -84,7 +84,7 @@ test("_copyFixtures ignores specifiers that do not name real files", () => { expect(existsSync(join(dst, "missing_FIXTURE.js"))).toBe(false); }); -test("createChildProcess marks the temp dir type:module only for module tests", async () => { +test("createChildProcess marks the temp dir type:module only for module tests and runs the entry in place", async () => { const dir = mkdtempSync(join(tmpdir(), "elide-agent-tmp-")); const entry = join(dir, "t.js"); writeFileSync(entry, "// entry"); @@ -101,8 +101,10 @@ test("createChildProcess marks the temp dir type:module only for module tests", agent._elideModule = true; await agent.createChildProcess([entry]); expect(JSON.parse(readFileSync(join(dir, "package.json"), "utf8"))).toEqual({ type: "module" }); - // Module entry runs as a `.mjs` copy. - expect(spawned[0][0]).toBe(join(dir, "t.mjs")); + // The module entry runs under its real `.js` name (parsed as ESM via the marker), + // so self/cyclic imports of that file dedupe to the single entry record. + expect(spawned[0][0]).toBe(entry); + expect(existsSync(join(dir, "t.mjs"))).toBe(false); agent._elideModule = false; await agent.createChildProcess([entry]); diff --git a/harness/src/manifest.test.ts b/harness/src/manifest.test.ts index 8837820..961a038 100644 --- a/harness/src/manifest.test.ts +++ b/harness/src/manifest.test.ts @@ -1,4 +1,10 @@ -import { existsSync, mkdtempSync, writeFileSync } from "node:fs"; +import { existsSync, mkdtempSync, readdirSync, writeFileSync } from "node:fs"; + +// A checkout without submodules still has the empty suite directories, so test the +// contents rather than the directory itself. +function populated(dir: string): boolean { + return existsSync(dir) && readdirSync(dir).length > 0; +} import { join } from "node:path"; import { tmpdir } from "node:os"; import { test, expect } from "bun:test"; @@ -57,7 +63,7 @@ test("javac langtools manifest enables the full tools/javac tree", () => { test("cpython manifest entries exist in the checked-out CPython suite", () => { const suiteRoot = `${import.meta.dir}/../../suites/cpython`; - if (!existsSync(suiteRoot)) return; + if (!populated(suiteRoot)) return; const manifest = loadManifest(`${import.meta.dir}/../../manifests/cpython-core.toml`); const groups = new Map(manifest.groups.map((group) => [group.id, group.include])); @@ -75,7 +81,7 @@ test("cpython manifest entries exist in the checked-out CPython suite", () => { test("wintertc WPT manifest includes checked-out paths when the suite exists", () => { const suiteRoot = `${import.meta.dir}/../../suites/wpt`; - if (!existsSync(suiteRoot)) return; + if (!populated(suiteRoot)) return; const manifest = loadManifest(`${import.meta.dir}/../../manifests/wintertc-wpt-2025.toml`); for (const path of manifest.groups.flatMap((group) => group.include)) { diff --git a/harness/src/registry.test.ts b/harness/src/registry.test.ts index 10c0b51..514d5a1 100644 --- a/harness/src/registry.test.ts +++ b/harness/src/registry.test.ts @@ -55,7 +55,7 @@ test("loads javac-jtreg workload from registry.toml", () => { expect(javac!.path).toBe("suites/openjdk"); expect(javac!.settings.manifest).toBe("manifests/javac-langtools.toml"); expect(javac!.settings.timeoutMs).toBe(3600000); - expect(javac!.settings.jtregCaseTimeoutSeconds).toBe(300); + expect(javac!.settings.jtregCaseTimeoutSeconds).toBe(900); expect(javac!.settings.javaRunner).toBe("java"); });