Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions test/core/wrap.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ afterEach(async () => {
describe("runWrappedCommand", () => {
it("preserves the child exit code and produces a compact result", async () => {
const wrapped = await runWrappedCommand([
"node",
process.execPath,
"-e",
"console.log('hello'); console.error('warning: noisy'); process.exit(3)",
"const fs = require('node:fs'); fs.writeSync(1, 'hello\\n'); fs.writeSync(2, 'warning: noisy\\n'); process.exit(3);",
]);

expect(wrapped.exitCode).toBe(3);
Expand All @@ -36,9 +36,9 @@ describe("runWrappedCommand", () => {
const storeDir = await createTempDir();

await runWrappedCommand([
"node",
process.execPath,
"-e",
"console.log('secret token value');",
"require('node:fs').writeSync(1, 'secret token value\\n');",
], {
storeDir,
});
Expand All @@ -49,9 +49,9 @@ describe("runWrappedCommand", () => {

it("caps captured output to avoid unbounded memory growth", async () => {
const wrapped = await runWrappedCommand([
"node",
process.execPath,
"-e",
"process.stdout.write('a'.repeat(2000));",
"require('node:fs').writeSync(1, 'a'.repeat(2000));",
], {
maxCaptureBytes: 128,
});
Expand All @@ -65,9 +65,9 @@ describe("runWrappedCommand", () => {
const storeDir = await createTempDir();

await runWrappedCommand([
"node",
process.execPath,
"-e",
"process.stdout.write('a'.repeat(2000));",
"require('node:fs').writeSync(1, 'a'.repeat(2000));",
], {
maxCaptureBytes: 128,
store: true,
Expand All @@ -81,9 +81,9 @@ describe("runWrappedCommand", () => {

it("supports a raw bypass for wrapped commands", async () => {
const wrapped = await runWrappedCommand([
"node",
process.execPath,
"-e",
"process.stdout.write('usage: cmd\\n\\nflag\\n');",
"require('node:fs').writeSync(1, 'usage: cmd\\n\\nflag\\n');",
], {
raw: true,
maxInlineChars: 4,
Expand All @@ -97,9 +97,9 @@ describe("runWrappedCommand", () => {
const storeDir = await createTempDir();

await runWrappedCommand([
"node",
process.execPath,
"-e",
"console.log('source tagged output');",
"require('node:fs').writeSync(1, 'source tagged output\\n');",
], {
source: "cursor",
recordStats: true,
Expand All @@ -113,9 +113,9 @@ describe("runWrappedCommand", () => {

it("does not flag lossless rewrites as authoritative compaction", async () => {
const wrapped = await runWrappedCommand([
"node",
process.execPath,
"-e",
"process.stdout.write('Deleted branch fix/cd-prefixed-raw-bypass-main (was 76b6858).\\n');",
"require('node:fs').writeSync(1, 'Deleted branch fix/cd-prefixed-raw-bypass-main (was 76b6858).\\n');",
]);

expect(wrapped.result.inlineText).toBe("Deleted branch fix/cd-prefixed-raw-bypass-main (was 76b6858).");
Expand All @@ -125,9 +125,9 @@ describe("runWrappedCommand", () => {

it("does not keep authoritative compaction when passthrough beats a lossy summary", async () => {
const wrapped = await runWrappedCommand([
"node",
process.execPath,
"-e",
"process.stdout.write(Array.from({ length: 13 }, (_, index) => `v${index}`).join('\\n') + '\\n');",
"require('node:fs').writeSync(1, Array.from({ length: 13 }, (_, index) => `v${index}`).join('\\n') + '\\n');",
]);

expect(wrapped.result.inlineText).toBe(Array.from({ length: 13 }, (_, index) => `v${index}`).join("\n"));
Expand All @@ -137,9 +137,9 @@ describe("runWrappedCommand", () => {

it("flags omitted summaries as authoritative compaction", async () => {
const wrapped = await runWrappedCommand([
"node",
process.execPath,
"-e",
"process.stdout.write(Array.from({ length: 40 }, (_, index) => `line ${index} ${'x'.repeat(80)}`).join('\\n'));",
"require('node:fs').writeSync(1, Array.from({ length: 40 }, (_, index) => `line ${index} ${'x'.repeat(80)}`).join('\\n'));",
]);

expect(wrapped.result.inlineText).toContain("omitted");
Expand Down
6 changes: 3 additions & 3 deletions test/hosts/claude-code.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ describe("doctorInstalledHooks", () => {
await mkdir(binDir, { recursive: true });
await writeFile(join(binDir, "tokenjuice"), "#!/usr/bin/env bash\nexit 0\n", { encoding: "utf8", mode: 0o755 });

const report = await doctorInstalledHooks();
const report = await doctorInstalledHooks({ projectDir: home });

expect(report.status).toBe("disabled");
expect(report.integrations["claude-code"].status).toBe("disabled");
Expand Down Expand Up @@ -707,7 +707,7 @@ describe("doctorInstalledHooks", () => {
await installCodeBuddyHook();
await installPiExtension(undefined, { local: true });

const report = await doctorInstalledHooks();
const report = await doctorInstalledHooks({ projectDir: home });

expect(report.status).toBe("ok");
expect(report.integrations.codex.status).toBe("ok");
Expand Down Expand Up @@ -752,7 +752,7 @@ describe("doctorInstalledHooks", () => {
await installCodeBuddyHook();
await installPiExtension(undefined, { local: true });

const report = await doctorInstalledHooks();
const report = await doctorInstalledHooks({ projectDir: home });

expect(report.status).toBe("ok");
expect(report.integrations.codex.status).toBe("disabled");
Expand Down
Loading