test(codex): normalize node tests on windows
This commit is contained in:
@@ -60,12 +60,13 @@ async function readComponentHookManifests() {
|
|||||||
|
|
||||||
function collectCommandHooks(hooks, source, version) {
|
function collectCommandHooks(hooks, source, version) {
|
||||||
const commandHooks = [];
|
const commandHooks = [];
|
||||||
|
const normalizedSource = source.replaceAll("\\", "/");
|
||||||
for (const [eventName, groups] of Object.entries(hooks.hooks)) {
|
for (const [eventName, groups] of Object.entries(hooks.hooks)) {
|
||||||
groups.forEach((group, groupIndex) => {
|
groups.forEach((group, groupIndex) => {
|
||||||
group.hooks.forEach((handler, handlerIndex) => {
|
group.hooks.forEach((handler, handlerIndex) => {
|
||||||
if (handler.type !== "command") return;
|
if (handler.type !== "command") return;
|
||||||
commandHooks.push({
|
commandHooks.push({
|
||||||
id: `${source}:${eventName}:${groupIndex}:${handlerIndex}`,
|
id: `${normalizedSource}:${eventName}:${groupIndex}:${handlerIndex}`,
|
||||||
version,
|
version,
|
||||||
statusMessage: handler.statusMessage,
|
statusMessage: handler.statusMessage,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ test("#given synced aggregate Codex skills #when inspected #then component and s
|
|||||||
assert.deepEqual(skillNames, expectedSkills);
|
assert.deepEqual(skillNames, expectedSkills);
|
||||||
for (const skillName of expectedSkills) {
|
for (const skillName of expectedSkills) {
|
||||||
const content = await readFile(join(skillsRoot, skillName, "SKILL.md"), "utf8");
|
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");
|
const interfaceMetadata = await readFile(join(skillRoot, "agents", "openai.yaml"), "utf8");
|
||||||
|
|
||||||
// then
|
// 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(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.match(interfaceMetadata, /display_name: "ulw-loop \(omo\)"/);
|
||||||
assert.doesNotMatch(interfaceMetadata, /ulw-loop \/ ulw-loop/);
|
assert.doesNotMatch(interfaceMetadata, /ulw-loop \/ ulw-loop/);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import assert from "node:assert/strict";
|
import assert from "node:assert/strict";
|
||||||
import { mkdir, readFile, readlink, stat, writeFile } from "node:fs/promises";
|
import { mkdir, readFile, readlink, stat, writeFile } from "node:fs/promises";
|
||||||
|
import { tmpdir } from "node:os";
|
||||||
import { dirname, join } from "node:path";
|
import { dirname, join } from "node:path";
|
||||||
import test from "node:test";
|
import test from "node:test";
|
||||||
import { fileURLToPath } from "node:url";
|
import { fileURLToPath } from "node:url";
|
||||||
@@ -11,15 +12,15 @@ const scriptDir = dirname(fileURLToPath(import.meta.url));
|
|||||||
const legacyCodexPluginMarketplace = ["code", "yeongyu", "codex", "plugins"].join("-");
|
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", () => {
|
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");
|
const codexHome = join(homeDir, ".codex");
|
||||||
|
|
||||||
assert.equal(resolveCodexInstallerBinDir({ codexHome, env: {}, homeDir }), join(homeDir, ".local", "bin"));
|
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", () => {
|
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 homeDir = join(tmpdir(), "omo-codex-home-custom");
|
||||||
const codexHome = join("/tmp", "omo-codex-install-custom");
|
const codexHome = join(tmpdir(), "omo-codex-install-custom");
|
||||||
|
|
||||||
assert.equal(resolveCodexInstallerBinDir({ codexHome, env: {}, homeDir }), join(codexHome, "bin"));
|
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", () => {
|
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 homeDir = join(tmpdir(), "omo-codex-home-explicit");
|
||||||
const codexHome = join("/tmp", "omo-codex-install-explicit");
|
const codexHome = join(tmpdir(), "omo-codex-install-explicit");
|
||||||
const explicitBinDir = join("/tmp", "omo-codex-explicit-bin");
|
const explicitBinDir = join(tmpdir(), "omo-codex-explicit-bin");
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
resolveCodexInstallerBinDir({
|
resolveCodexInstallerBinDir({
|
||||||
|
|||||||
Reference in New Issue
Block a user