test: migrated test imports to package subpath exports

- Replaced relative `../src` imports with `@oh-my-pi/pi-ai` and `@oh-my-pi/pi-agent-core` subpaths.
This commit is contained in:
can1357
2026-06-08 18:53:15 +02:00
parent e79415e78b
commit 9d457f73d9
458 changed files with 1531 additions and 1181 deletions
@@ -2,13 +2,18 @@ import { afterEach, describe, expect, it, spyOn, vi } from "bun:test";
import * as fs from "node:fs/promises";
import * as os from "node:os";
import * as path from "node:path";
import { Settings } from "../../src/config/settings";
import * as dapModule from "../../src/dap";
import { DapClient } from "../../src/dap/client";
import { DapSessionManager } from "../../src/dap/session";
import type { DapCapabilities, DapClientState, DapEventMessage, DapResolvedAdapter } from "../../src/dap/types";
import type { ToolSession } from "../../src/tools";
import { DebugTool } from "../../src/tools/debug";
import { Settings } from "@oh-my-pi/pi-coding-agent/config/settings";
import * as dapModule from "@oh-my-pi/pi-coding-agent/dap";
import { DapClient } from "@oh-my-pi/pi-coding-agent/dap/client";
import { DapSessionManager } from "@oh-my-pi/pi-coding-agent/dap/session";
import type {
DapCapabilities,
DapClientState,
DapEventMessage,
DapResolvedAdapter,
} from "@oh-my-pi/pi-coding-agent/dap/types";
import type { ToolSession } from "@oh-my-pi/pi-coding-agent/tools";
import { DebugTool } from "@oh-my-pi/pi-coding-agent/tools/debug";
const TEST_ADAPTER: DapResolvedAdapter = {
name: "lldb-dap",
@@ -3,7 +3,7 @@ import {
formatDebugLogExpandedLines,
formatDebugLogLine,
parseDebugLogTimestampMs,
} from "../../src/debug/log-formatting";
} from "@oh-my-pi/pi-coding-agent/debug/log-formatting";
describe("formatDebugLogLine", () => {
it("strips ANSI codes and carriage returns", () => {
@@ -4,7 +4,7 @@ import {
DebugLogViewerModel,
LOAD_OLDER_LABEL,
SESSION_BOUNDARY_WARNING,
} from "../../src/debug/log-viewer";
} from "@oh-my-pi/pi-coding-agent/debug/log-viewer";
describe("DebugLogViewerModel", () => {
const describeRow = (row: { kind: string; logIndex?: number }): string => {
@@ -1,12 +1,12 @@
import { afterEach, beforeAll, describe, expect, it } from "bun:test";
import { getImageDimensions, ImageBudget, ImageProtocol, TERMINAL } from "@oh-my-pi/pi-tui";
import {
buildLargeTextLines,
buildSampleImage,
encodeRgbPng,
ProtocolProbeComponent,
} from "../../src/debug/protocol-probe";
import { initTheme } from "../../src/modes/theme/theme";
} from "@oh-my-pi/pi-coding-agent/debug/protocol-probe";
import { initTheme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme";
import { getImageDimensions, ImageBudget, ImageProtocol, TERMINAL } from "@oh-my-pi/pi-tui";
beforeAll(async () => {
// buildLargeTextLines styles the OSC 66 span through the global theme singleton.
@@ -1,6 +1,10 @@
import { describe, expect, it } from "bun:test";
import type { Model } from "@oh-my-pi/pi-ai";
import { RawSseDebugBuffer, rawSseRecordLines, resolveRawSseDebugBuffer } from "../../src/debug/raw-sse-buffer";
import {
RawSseDebugBuffer,
rawSseRecordLines,
resolveRawSseDebugBuffer,
} from "@oh-my-pi/pi-coding-agent/debug/raw-sse-buffer";
const model: Model<"anthropic-messages"> = {
id: "claude-test",
@@ -1,5 +1,5 @@
import { describe, expect, it } from "bun:test";
import { expandPrettyDataLines } from "../../src/debug/raw-sse";
import { expandPrettyDataLines } from "@oh-my-pi/pi-coding-agent/debug/raw-sse";
// Wide enough that `truncateToWidth` would clip the payload in the viewer; matches
// what real Codex `response.output_item.done` frames look like on the wire.
@@ -3,9 +3,9 @@ import * as fs from "node:fs/promises";
import * as os from "node:os";
import * as path from "node:path";
import type { Model } from "@oh-my-pi/pi-ai";
import { RawSseDebugBuffer } from "@oh-my-pi/pi-coding-agent/debug/raw-sse-buffer";
import { createReportBundle } from "@oh-my-pi/pi-coding-agent/debug/report-bundle";
import { getConfigRootDir, setAgentDir } from "@oh-my-pi/pi-utils";
import { RawSseDebugBuffer } from "../../src/debug/raw-sse-buffer";
import { createReportBundle } from "../../src/debug/report-bundle";
const model: Model<"anthropic-messages"> = {
id: "claude-test",
@@ -1,6 +1,10 @@
import { describe, expect, it } from "bun:test";
import {
collectTerminalState,
formatTerminalState,
type TerminalStateInfo,
} from "@oh-my-pi/pi-coding-agent/debug/terminal-info";
import { TERMINAL } from "@oh-my-pi/pi-tui";
import { collectTerminalState, formatTerminalState, type TerminalStateInfo } from "../../src/debug/terminal-info";
const sample: TerminalStateInfo = {
detectedId: "kitty",