test(codex): normalize node tests on windows

This commit is contained in:
YeonGyu-Kim
2026-05-31 01:52:47 +09:00
parent 4434ee3aa1
commit fd950932a6
3 changed files with 11 additions and 9 deletions
@@ -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,
});
@@ -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/);
@@ -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({