fix(ci): remove undeclared dependency and handle PTY chunks
This commit is contained in:
1 parent
2cb29693c3
commit
3c05b4d3fe
3 files changed
+19
-15
No files matched your search
@@ -111,7 +111,7 @@
|
||||
+ existingSha = data.sha;
|
||||
+ }
|
||||
+ catch (error) {
|
||||
+ if (!(error instanceof request_error_1.RequestError && error.status === 404)) {
|
||||
+ if (!(error && error.status === 404)) {
|
||||
+ throw error;
|
||||
+ }
|
||||
+ }
|
||||
|
||||
@@ -10,7 +10,6 @@ import { createRequire } from "node:module";
|
||||
import { dirname, join } from "node:path";
|
||||
import { fileURLToPath, pathToFileURL } from "node:url";
|
||||
import { promisify } from "node:util";
|
||||
import { RequestError } from "@octokit/request-error";
|
||||
import { afterEach, beforeAll, expect, it, vi } from "vitest";
|
||||
import { z } from "zod";
|
||||
|
||||
@@ -106,15 +105,11 @@ it("creates overflow notes on a new branch without requiring an existing file",
|
||||
createNewBranch,
|
||||
octokit: {
|
||||
repos: {
|
||||
getContent: vi.fn().mockRejectedValue(
|
||||
new RequestError("missing", 404, {
|
||||
request: {
|
||||
method: "GET",
|
||||
url: "https://example.test/notes",
|
||||
headers: {},
|
||||
},
|
||||
}),
|
||||
),
|
||||
getContent: vi
|
||||
.fn()
|
||||
.mockRejectedValue(
|
||||
Object.assign(new Error("missing"), { status: 404 }),
|
||||
),
|
||||
createOrUpdateFileContents: write,
|
||||
},
|
||||
},
|
||||
|
||||
@@ -115,11 +115,20 @@ itWithCaptureCapability(
|
||||
};
|
||||
|
||||
const expanded = await capture("x".repeat(500));
|
||||
expect(expanded.frames).toHaveLength(0);
|
||||
expect(expanded.truncated).toBe(true);
|
||||
const retainedNormalized = expanded.frames.map(({ data }) => data).join("");
|
||||
const retainedRaw = expanded.frames
|
||||
.map(({ raw_data, data }) => raw_data ?? data)
|
||||
.join("");
|
||||
// PTY read boundaries need not match the child's write. A small chunk can
|
||||
// fit even after another chunk was omitted for exceeding the budget.
|
||||
expect(retainedNormalized).toBe(
|
||||
retainedRaw.replaceAll("a", "x".repeat(500)),
|
||||
);
|
||||
expect(Buffer.byteLength(retainedNormalized)).toBeLessThanOrEqual(1_000);
|
||||
expect(expanded.truncation_details.normalized_terminal).toMatchObject({
|
||||
budget_bytes: 1_000,
|
||||
retained_bytes: 0,
|
||||
retained_bytes: Buffer.byteLength(retainedNormalized),
|
||||
omitted_frames: expect.any(Number),
|
||||
});
|
||||
expect(
|
||||
@@ -128,9 +137,9 @@ itWithCaptureCapability(
|
||||
expect(expanded.truncation_details.raw_terminal).toMatchObject({
|
||||
budget_bytes: 1_000,
|
||||
observed_bytes: expect.any(Number),
|
||||
retained_bytes: 0,
|
||||
retained_bytes: Buffer.byteLength(retainedRaw),
|
||||
observed_frames: expect.any(Number),
|
||||
retained_frames: 0,
|
||||
retained_frames: expanded.frames.length,
|
||||
});
|
||||
expect(
|
||||
expanded.limitations.some((limitation) =>
|
||||
|
||||
Reference in new issue
Block a user