From fd950932a6004a5e4310c162697420588b32b53e Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Sun, 31 May 2026 01:52:47 +0900 Subject: [PATCH] test(codex): normalize node tests on windows --- .../plugin/test/hook-status-message.test.mjs | 3 ++- packages/omo-codex/plugin/test/sync-skills.test.mjs | 4 ++-- packages/omo-codex/scripts/install-local.test.mjs | 13 +++++++------ 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/packages/omo-codex/plugin/test/hook-status-message.test.mjs b/packages/omo-codex/plugin/test/hook-status-message.test.mjs index 961c56b0f..597a720b8 100644 --- a/packages/omo-codex/plugin/test/hook-status-message.test.mjs +++ b/packages/omo-codex/plugin/test/hook-status-message.test.mjs @@ -60,12 +60,13 @@ async function readComponentHookManifests() { function collectCommandHooks(hooks, source, version) { const commandHooks = []; + const normalizedSource = source.replaceAll("\\", "/"); for (const [eventName, groups] of Object.entries(hooks.hooks)) { groups.forEach((group, groupIndex) => { group.hooks.forEach((handler, handlerIndex) => { if (handler.type !== "command") return; commandHooks.push({ - id: `${source}:${eventName}:${groupIndex}:${handlerIndex}`, + id: `${normalizedSource}:${eventName}:${groupIndex}:${handlerIndex}`, version, statusMessage: handler.statusMessage, }); diff --git a/packages/omo-codex/plugin/test/sync-skills.test.mjs b/packages/omo-codex/plugin/test/sync-skills.test.mjs index 8169d08b8..f080421a3 100644 --- a/packages/omo-codex/plugin/test/sync-skills.test.mjs +++ b/packages/omo-codex/plugin/test/sync-skills.test.mjs @@ -60,7 +60,7 @@ test("#given synced aggregate Codex skills #when inspected #then component and s assert.deepEqual(skillNames, expectedSkills); for (const skillName of expectedSkills) { const content = await readFile(join(skillsRoot, skillName, "SKILL.md"), "utf8"); - assert.match(content, /^---\n/); + assert.match(content, /^---\r?\n/); } }); @@ -132,7 +132,7 @@ test("#given synced ulw-loop skill #when Codex hint metadata is inspected #then const interfaceMetadata = await readFile(join(skillRoot, "agents", "openai.yaml"), "utf8"); // then - assert.match(skill, /^---\nname: ulw-loop\n/m); + assert.match(skill, /^---\r?\nname: ulw-loop\r?\n/m); assert.match(skill, /Goal-like loop that uses ultrawork mode to decompose work into systematic, evidence-bound steps\./); assert.match(interfaceMetadata, /display_name: "ulw-loop \(omo\)"/); assert.doesNotMatch(interfaceMetadata, /ulw-loop \/ ulw-loop/); diff --git a/packages/omo-codex/scripts/install-local.test.mjs b/packages/omo-codex/scripts/install-local.test.mjs index 767138e93..3d2cffe07 100644 --- a/packages/omo-codex/scripts/install-local.test.mjs +++ b/packages/omo-codex/scripts/install-local.test.mjs @@ -1,5 +1,6 @@ import assert from "node:assert/strict"; import { mkdir, readFile, readlink, stat, writeFile } from "node:fs/promises"; +import { tmpdir } from "node:os"; import { dirname, join } from "node:path"; import test from "node:test"; import { fileURLToPath } from "node:url"; @@ -11,15 +12,15 @@ const scriptDir = dirname(fileURLToPath(import.meta.url)); const legacyCodexPluginMarketplace = ["code", "yeongyu", "codex", "plugins"].join("-"); test("#given default CODEX_HOME #when resolving local installer bin dir without override #then preserves user local bin precedence", () => { - const homeDir = join("/tmp", "omo-codex-home-default"); + const homeDir = join(tmpdir(), "omo-codex-home-default"); const codexHome = join(homeDir, ".codex"); assert.equal(resolveCodexInstallerBinDir({ codexHome, env: {}, homeDir }), join(homeDir, ".local", "bin")); }); test("#given custom CODEX_HOME #when resolving local installer bin dir without override #then keeps generated omo inside that Codex home", () => { - const homeDir = join("/tmp", "omo-codex-home-custom"); - const codexHome = join("/tmp", "omo-codex-install-custom"); + const homeDir = join(tmpdir(), "omo-codex-home-custom"); + const codexHome = join(tmpdir(), "omo-codex-install-custom"); assert.equal(resolveCodexInstallerBinDir({ codexHome, env: {}, homeDir }), join(codexHome, "bin")); }); @@ -52,9 +53,9 @@ test("#given custom CODEX_HOME and PATH without omo #when installing locally wit }); test("#given explicit CODEX_LOCAL_BIN_DIR #when resolving local installer bin dir #then preserves installed omo precedence", () => { - const homeDir = join("/tmp", "omo-codex-home-explicit"); - const codexHome = join("/tmp", "omo-codex-install-explicit"); - const explicitBinDir = join("/tmp", "omo-codex-explicit-bin"); + const homeDir = join(tmpdir(), "omo-codex-home-explicit"); + const codexHome = join(tmpdir(), "omo-codex-install-explicit"); + const explicitBinDir = join(tmpdir(), "omo-codex-explicit-bin"); assert.equal( resolveCodexInstallerBinDir({