test(omo-codex): cover linkCachedPluginAgents in CI codex-compatibility matrix
Add the cross-platform agent-linker test file to the explicit list in the
'test:codex' script so the existing codex-compatibility CI job, which
runs on ubuntu-latest / macos-latest / windows-latest, actually exercises
it on every supported host OS.
Also add one host-platform test that omits the 'platform' parameter and
asserts against process.platform directly: on Unix the test verifies
symlinks land at ${CODEX_HOME}/agents; on Windows it verifies regular
file copies with the bundled name field. The other nine tests still mock
the 'platform' parameter to exercise all three code paths on every host;
this tenth test is the real-host integration check that the platform
detection logic itself works.
Result: 10 tests in src/cli/install-codex/link-cached-plugin-agents.test.ts,
all wired into 'bun run test:codex', which the existing CI matrix runs
on every push and PR to master/dev across all three supported operating
systems.
This commit is contained in:
+1
-1
@@ -65,7 +65,7 @@
|
||||
"typecheck:packages": "tsgo --noEmit -p packages/rules-engine/tsconfig.json && tsgo --noEmit -p packages/ast-grep-core/tsconfig.json && tsgo --noEmit -p packages/ast-grep-mcp/tsconfig.json && tsgo --noEmit -p packages/utils/tsconfig.json && tsgo --noEmit -p packages/model-core/tsconfig.json && tsgo --noEmit -p packages/prompts-core/tsconfig.json && tsgo --noEmit -p packages/comment-checker-core/tsconfig.json && tsgo --noEmit -p packages/hashline-core/tsconfig.json && tsgo --noEmit -p packages/boulder-state/tsconfig.json && tsgo --noEmit -p packages/agents-md-core/tsconfig.json && tsgo --noEmit -p packages/omo-codex/tsconfig.json",
|
||||
"typecheck:script": "tsgo --noEmit -p script/tsconfig.json",
|
||||
"test": "bun test",
|
||||
"test:codex": "bun test src/cli/install-codex/codex-cache.test.ts src/cli/install-codex/install-codex.test.ts packages/omo-codex/src/**/*.test.ts packages/utils/src/jsonc-parser.test.ts packages/utils/src/frontmatter.test.ts packages/hashline-core/src/hash-computation.test.ts packages/hashline-core/src/smoke-untested-modules.test.ts packages/rules-engine/src/index.test.ts packages/rules-engine/src/security-boundary.test.ts packages/agents-md-core/src/injector.test.ts && node --test packages/omo-codex/plugin/test/*.test.mjs packages/omo-codex/scripts/install-local.test.mjs packages/omo-codex/scripts/sync-telemetry-component.test.mjs",
|
||||
"test:codex": "bun test src/cli/install-codex/codex-cache.test.ts src/cli/install-codex/install-codex.test.ts src/cli/install-codex/link-cached-plugin-agents.test.ts packages/omo-codex/src/**/*.test.ts packages/utils/src/jsonc-parser.test.ts packages/utils/src/frontmatter.test.ts packages/hashline-core/src/hash-computation.test.ts packages/hashline-core/src/smoke-untested-modules.test.ts packages/rules-engine/src/index.test.ts packages/rules-engine/src/security-boundary.test.ts packages/agents-md-core/src/injector.test.ts && node --test packages/omo-codex/plugin/test/*.test.mjs packages/omo-codex/scripts/install-local.test.mjs packages/omo-codex/scripts/sync-telemetry-component.test.mjs",
|
||||
"test:windows-codex": "bun run test:codex",
|
||||
"build:ast-grep-mcp": "bun run --cwd packages/ast-grep-mcp build"
|
||||
},
|
||||
|
||||
@@ -180,4 +180,26 @@ describe("linkCachedPluginAgents", () => {
|
||||
) as { agents: string[] }
|
||||
expect(manifest.agents).toEqual([])
|
||||
})
|
||||
|
||||
test("auto-detects host platform when platform parameter is omitted", async () => {
|
||||
// given - no `platform` argument, so process.platform decides
|
||||
const { codexHome, pluginRoot } = await makeFixture()
|
||||
|
||||
// when
|
||||
const linked = await linkCachedPluginAgents({ codexHome, pluginRoot })
|
||||
|
||||
// then - on Unix expect symlinks; on Windows expect file copies
|
||||
expect(linked).toHaveLength(3)
|
||||
for (const entry of linked) {
|
||||
const linkStat = await lstat(entry.path)
|
||||
if (process.platform === "win32") {
|
||||
expect(linkStat.isSymbolicLink()).toBe(false)
|
||||
expect(linkStat.isFile()).toBe(true)
|
||||
const content = await readFile(entry.path, "utf8")
|
||||
expect(content).toContain(`name = "${entry.name.replace(/\.toml$/, "")}"`)
|
||||
} else {
|
||||
expect(linkStat.isSymbolicLink()).toBe(true)
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user