Skip to content
Closed
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ node_modules
.DS_Store
.pnpm-store
npm-debug.log
bun.lock

# Coverage
coverage/
Expand Down
3 changes: 3 additions & 0 deletions bunfig.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[test]
root = "./tests"
coverage = false
21 changes: 11 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,18 @@
"@mariozechner/pi-ai": "^0.57.1",
"@mariozechner/pi-coding-agent": "^0.57.1",
"@mariozechner/pi-tui": "^0.57.1",
"@sinclair/typebox": "^0.34.48",
"@types/node": "^25.5.0",
"@typescript-eslint/eslint-plugin": "^8.38.0",
"@typescript-eslint/parser": "^8.38.0",
"@sinclair/typebox": "^0.34.49",
"@types/bun": "^1.3.14",
"@types/node": "^25.9.1",
"@typescript-eslint/eslint-plugin": "^8.59.4",
"@typescript-eslint/parser": "^8.59.4",
"@vitest/coverage-v8": "^2.1.9",
"eslint": "^9.9.0",
"eslint-config-prettier": "^9.1.0",
"globals": "^17.4.0",
"eslint": "^9.39.4",
"eslint-config-prettier": "^9.1.2",
"globals": "^17.6.0",
"markdownlint-cli": "^0.42.0",
"prettier": "^3.3.3",
"typescript": "^5.6.2",
"vitest": "^2.1.1"
"prettier": "^3.8.3",
"typescript": "^5.9.3",
"vitest": "^2.1.9"
}
}
14 changes: 10 additions & 4 deletions tests/render.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,19 @@ import {
setTaskListExpanded,
} from "../.pi/extensions/workflow-orchestrator/render.js";

// Portable frozen clock: works with both vitest and bun test runners.
const FROZEN_NOW = new Date("2026-03-15T12:00:00.000Z").getTime();
let originalDateNow: () => number;

describe("render.ts", () => {
let mockCtx: ExtensionContext;
let mockUi: any;

beforeEach(() => {
// Freeze Date.now() without relying on vitest fake timers
originalDateNow = Date.now;
Date.now = () => FROZEN_NOW;

mockUi = {
setStatus: vi.fn(),
setWidget: vi.fn(),
Expand All @@ -30,16 +38,14 @@ describe("render.ts", () => {
appendEntry: vi.fn(),
},
} as unknown as ExtensionContext;

vi.useFakeTimers();
vi.setSystemTime(new Date("2026-03-15T12:00:00.000Z"));
});

afterEach(() => {
vi.useRealTimers();
Date.now = originalDateNow;
vi.clearAllMocks();
});


function createBaseState(overrides?: Partial<WorkflowState>): WorkflowState {
return {
runId: "test-run",
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"types": ["node"]
"types": ["node", "bun-types"]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Use correct Bun type library name

compilerOptions.types entries are resolved by package name, and the dependency added here is @types/bun (which should be referenced as "bun"), not "bun-types". In a clean install this causes tsc to fail with “Cannot find type definition file for 'bun-types'”, which breaks npm run typecheck/CI for this commit until either bun-types is installed explicitly or the types entry is corrected.

Useful? React with 👍 / 👎.

},
"include": [".pi/extensions/**/*.ts", "tests/**/*.ts"]
}
Loading