fix: convert node:test API calls to vitest equivalents
- t.after() → afterEach() with import injection
- t.before() → beforeEach() with import injection
- t.test() → test() (flatten subtests)
- t.skip() → return with skip comment
- Fix vitest.config.ts poolOptions deprecation for Vitest 4
- Run fix-vitest-api.mjs across 108 affected test files
💘 Generated with Crush
Assisted-by: GLM-5.1 via Crush <crush@charm.land>
This commit is contained in:
parent
01d8f2fad6
commit
b62f7b20ec
223 changed files with 1267 additions and 753 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { describe, it } from "node:test";
|
||||
import { describe, it } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import { z } from "zod";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// SF — Regression tests for importLocalModule candidate resolution (#3954)
|
||||
import { describe, it } from "node:test";
|
||||
import { describe, it } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
|
||||
import { _buildImportCandidates } from "./workflow-tools.js";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { describe, it } from "node:test";
|
||||
import { describe, it } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import { mkdtempSync, mkdirSync, rmSync, writeFileSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { describe, it } from "node:test";
|
||||
import { describe, it } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import { mkdirSync, rmSync, writeFileSync, existsSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { test, describe } from "node:test";
|
||||
import { describe } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import { createRequire } from "node:module";
|
||||
import * as path from "node:path";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { test, describe } from "node:test";
|
||||
import { describe } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import { createRequire } from "node:module";
|
||||
import * as path from "node:path";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { test, describe } from "node:test";
|
||||
import { describe } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import { createRequire } from "node:module";
|
||||
import * as path from "node:path";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { test, describe } from "node:test";
|
||||
import { describe } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import { createRequire } from "node:module";
|
||||
import * as path from "node:path";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { test, describe } from "node:test";
|
||||
import { describe } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import { createRequire } from "node:module";
|
||||
import * as path from "node:path";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { test, describe } from "node:test";
|
||||
import { describe } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import { createRequire } from "node:module";
|
||||
import * as path from "node:path";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { test, describe } from "node:test";
|
||||
import { describe } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import { createRequire } from "node:module";
|
||||
import * as path from "node:path";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { test, describe } from "node:test";
|
||||
import { describe } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import { createRequire } from "node:module";
|
||||
import * as path from "node:path";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { test, describe } from "node:test";
|
||||
import { describe } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import { createRequire } from "node:module";
|
||||
import * as path from "node:path";
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
* declared "type": "module" and strict ESM resolution was enforced.
|
||||
*/
|
||||
|
||||
import { test, describe } from "node:test";
|
||||
import { describe } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import { readFileSync } from "node:fs";
|
||||
import * as path from "node:path";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { test, describe } from "node:test";
|
||||
import { describe } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import { createRequire } from "node:module";
|
||||
import * as path from "node:path";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { test, describe } from "node:test";
|
||||
import { describe } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import { processStreamChunk } from "../stream-process/index.ts";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { test, describe } from "node:test";
|
||||
import { describe } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import { createRequire } from "node:module";
|
||||
import * as path from "node:path";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { test, describe } from "node:test";
|
||||
import { describe } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import { createRequire } from "node:module";
|
||||
import * as path from "node:path";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { test, describe } from "node:test";
|
||||
import { describe } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import { createRequire } from "node:module";
|
||||
import * as path from "node:path";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { describe, it } from "node:test";
|
||||
import { describe, it } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import { xxHash32, xxHash32Fallback } from "@singularity-forge/native/xxhash";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// agent-loop tests
|
||||
// Covers: pauseTurn handling (#2869), schema overload retry cap (#2783)
|
||||
|
||||
import { describe, it, mock } from "node:test";
|
||||
import { describe, it } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { join, dirname } from "node:path";
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
// and that the footer reads activeInferenceModel instead of state.model.
|
||||
// Regression test for https://github.com/singularity-forge/sf-run/issues/1844 Bug 2
|
||||
|
||||
import { describe, it } from "node:test";
|
||||
import { describe, it } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { join, dirname } from "node:path";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import assert from "node:assert/strict";
|
||||
import { describe, it } from "node:test";
|
||||
import { describe, it } from 'vitest';
|
||||
import { getEnvApiKey } from "./env-api-keys.js";
|
||||
|
||||
describe("getEnvApiKey", () => {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { describe, it } from "node:test";
|
||||
import { describe, it } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import { MODELS } from "./models.generated.js";
|
||||
import { getModel, getModels, getProviders } from "./models.js";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { describe, it } from "node:test";
|
||||
import { describe, it } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import { getProviders, getModels, getModel, supportsXhigh, applyCapabilityPatches } from "./models.js";
|
||||
import type { Api, Model } from "./types.js";
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
* Related: #4392 (opus-4-7 adaptive thinking not recognised on Bedrock)
|
||||
* #4352 (pre-existing: only opus-4-6 / sonnet-4-6 whitelisted)
|
||||
*/
|
||||
import { describe, it } from "node:test";
|
||||
import { describe, it } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
|
||||
import {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import test from "node:test";
|
||||
import { test } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { dirname, join } from "node:path";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { describe, it } from "node:test";
|
||||
import { describe, it } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import { convertTools, mapStopReason } from "./anthropic-shared.js";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { describe, it } from "node:test";
|
||||
import { describe, it } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import { sanitizeSchemaForGoogle } from "./google-shared.js";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// SF — Provider Capabilities Registry Tests (ADR-005 Phase 1)
|
||||
import { describe, test } from "node:test";
|
||||
import { describe } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
|
||||
import {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import assert from "node:assert/strict";
|
||||
import { describe, it } from "node:test";
|
||||
import { describe, it } from 'vitest';
|
||||
import type { Model } from "../types.js";
|
||||
import { isAutoReasoning, resolveReasoningLevel } from "./simple-options.js";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// SF — ProviderSwitchReport Tests (ADR-005 Phase 3)
|
||||
import { describe, test } from "node:test";
|
||||
import { describe } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
|
||||
import { transformMessages, createEmptyReport, hasTransformations } from "./transform-messages.js";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import assert from "node:assert/strict";
|
||||
import { describe, it } from "node:test";
|
||||
import { describe, it } from 'vitest';
|
||||
import { parseAnthropicSSE } from "./event-stream.js";
|
||||
|
||||
function createMockResponse(chunks: string[]): Response {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
import { test } from 'vitest';
|
||||
|
||||
import type { Api, Model } from "../../types.js";
|
||||
import type { OAuthCredentials } from "./index.js";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { describe, test } from "node:test";
|
||||
import { describe } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import { parseStreamingJson } from "../json-parse.js";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { describe, test } from "node:test";
|
||||
import { describe } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
|
||||
import { isContextOverflow } from "../overflow.js";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { describe, test } from "node:test";
|
||||
import { describe } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import {
|
||||
repairToolJson,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import assert from "node:assert/strict";
|
||||
import { describe, it } from "node:test";
|
||||
import { describe, it } from 'vitest';
|
||||
import { parseArgs } from "./args.js";
|
||||
|
||||
describe("parseArgs", () => {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import assert from "node:assert/strict";
|
||||
import { afterEach, beforeEach, describe, it } from "node:test";
|
||||
import { afterEach, beforeEach, describe, it } from 'vitest';
|
||||
import type { Model } from "@singularity-forge/pi-ai";
|
||||
import type { ModelRegistry } from "../core/model-registry.js";
|
||||
import { listModels } from "./list-models.js";
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import assert from "node:assert/strict";
|
|||
import { mkdtempSync, rmSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
import { afterEach, beforeEach, describe, it } from "node:test";
|
||||
import { afterEach, beforeEach, describe, it } from 'vitest';
|
||||
|
||||
import { Agent, type AgentMessage } from "@singularity-forge/pi-agent-core";
|
||||
import { AgentSession } from "./agent-session.js";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import test from "node:test";
|
||||
import { test } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import test from "node:test";
|
||||
import { test } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import assert from "node:assert/strict";
|
|||
import { mkdtempSync, rmSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
import { afterEach, beforeEach, describe, it } from "node:test";
|
||||
import { afterEach, beforeEach, describe, it } from 'vitest';
|
||||
|
||||
import { Agent } from "@singularity-forge/pi-agent-core";
|
||||
import { Type } from "@sinclair/typebox";
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// SF — Regression tests for #3616: tool list persistence across newSession() calls
|
||||
// Copyright (c) 2026 Jeremy McSpadden <jeremy@fluxlabs.net>
|
||||
|
||||
import test, { describe } from "node:test";
|
||||
import { test, describe } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { describe, it } from "node:test";
|
||||
import { describe, it } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import { AuthStorage } from "./auth-storage.js";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import assert from "node:assert/strict";
|
||||
import { test } from "node:test";
|
||||
import { } from 'vitest';
|
||||
|
||||
import { handleAgentEvent } from "../modes/interactive/controllers/chat-controller.js";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
import { test } from 'vitest';
|
||||
|
||||
import type { Message } from "@singularity-forge/pi-ai";
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
*/
|
||||
|
||||
import assert from "node:assert/strict";
|
||||
import { describe, it, mock } from "node:test";
|
||||
import { vi, describe, it } from 'vitest';
|
||||
|
||||
import type { AgentMessage } from "@singularity-forge/pi-agent-core";
|
||||
import type { Model, AssistantMessage } from "@singularity-forge/pi-ai";
|
||||
|
|
@ -126,7 +126,7 @@ describe("generateSummary — chunked fallback (#2932)", () => {
|
|||
|
||||
// Track calls
|
||||
const calls: string[] = [];
|
||||
const mockComplete = mock.fn(async (_model: any, context: any, _options: any) => {
|
||||
const mockComplete = vi.fn(async (_model: any, context: any, _options: any) => {
|
||||
const userMsg = context.messages?.[0];
|
||||
const text =
|
||||
typeof userMsg?.content === "string"
|
||||
|
|
@ -184,7 +184,7 @@ describe("generateSummary — chunked fallback (#2932)", () => {
|
|||
`Test setup: ${totalTokens} tokens should fit in ${model.contextWindow} context window`,
|
||||
);
|
||||
|
||||
const mockComplete = mock.fn(async () => makeFakeResponse("Single pass summary"));
|
||||
const mockComplete = vi.fn(async () => makeFakeResponse("Single pass summary"));
|
||||
|
||||
await generateSummary(messages, model, reserveTokens, undefined, undefined, undefined, undefined, mockComplete);
|
||||
|
||||
|
|
@ -206,7 +206,7 @@ describe("generateSummary — chunked fallback (#2932)", () => {
|
|||
const previousSummary = "Previous session summary content";
|
||||
|
||||
const prompts: string[] = [];
|
||||
const mockComplete = mock.fn(async (_model: any, context: any) => {
|
||||
const mockComplete = vi.fn(async (_model: any, context: any) => {
|
||||
const userMsg = context.messages?.[0];
|
||||
const text =
|
||||
typeof userMsg?.content === "string"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { describe, it } from "node:test";
|
||||
import { describe, it } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import { ContextualTips } from "./contextual-tips.js";
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import assert from "node:assert/strict";
|
|||
import { mkdirSync, rmSync, writeFileSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
import { afterEach, beforeEach, describe, it } from "node:test";
|
||||
import { afterEach, beforeEach, describe, it } from 'vitest';
|
||||
import { ModelDiscoveryCache } from "./discovery-cache.js";
|
||||
|
||||
let testDir: string;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// SF — Extension Manifest Tests
|
||||
// Copyright (c) 2026 Jeremy McSpadden <jeremy@fluxlabs.net>
|
||||
|
||||
import { describe, it } from "node:test";
|
||||
import { describe, it } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import { mkdtempSync, mkdirSync, writeFileSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// SF — Extension Sort Tests
|
||||
// Copyright (c) 2026 Jeremy McSpadden <jeremy@fluxlabs.net>
|
||||
|
||||
import { describe, it } from "node:test";
|
||||
import { describe, it } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import { mkdtempSync, mkdirSync, writeFileSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { describe, it, beforeEach, afterEach } from "node:test";
|
||||
import { describe, it, beforeEach, afterEach } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import * as fs from "node:fs";
|
||||
import * as os from "node:os";
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// sf — Regression test: pendingProviderRegistrations must be flushed exactly once (#3576)
|
||||
// Copyright (c) 2026 Jeremy McSpadden <jeremy@fluxlabs.net>
|
||||
|
||||
import { describe, it } from "node:test";
|
||||
import { describe, it } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import assert from "node:assert/strict";
|
||||
import { describe, it, mock } from "node:test";
|
||||
import { describe, it } from 'vitest';
|
||||
import { ExtensionRunner } from "./runner.js";
|
||||
import type { Extension, ExtensionRuntime, ToolCallEvent } from "./index.js";
|
||||
import { SessionManager } from "../session-manager.js";
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// SF Provider Fallback Resolver Tests
|
||||
// Copyright (c) 2026 Jeremy McSpadden <jeremy@fluxlabs.net>
|
||||
|
||||
import { describe, it, beforeEach, mock } from "node:test";
|
||||
import { vi, describe, it, beforeEach } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import { FallbackResolver } from "./fallback-resolver.js";
|
||||
import type { Api, Model } from "@singularity-forge/pi-ai";
|
||||
|
|
@ -49,7 +49,7 @@ function createResolver(overrides?: {
|
|||
} as unknown as SettingsManager;
|
||||
|
||||
const authStorage = {
|
||||
markProviderExhausted: mock.fn(),
|
||||
markProviderExhausted: vi.fn(),
|
||||
isProviderAvailable: overrides?.isProviderAvailable ?? (() => true),
|
||||
hasAuth: overrides?.hasAuth ?? (() => true),
|
||||
} as unknown as AuthStorage;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import assert from "node:assert/strict";
|
||||
import { describe, it, afterEach } from "node:test";
|
||||
import { describe, it, afterEach } from 'vitest';
|
||||
import { mkdtempSync, readFileSync, rmSync, existsSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
import { tmpdir } from "node:os";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import assert from "node:assert/strict";
|
||||
import { describe, it } from "node:test";
|
||||
import { describe, it } from 'vitest';
|
||||
import {
|
||||
isImageDimensionError,
|
||||
MANY_IMAGE_MAX_DIMENSION,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import assert from "node:assert/strict";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
import test from "node:test";
|
||||
import { test } from 'vitest';
|
||||
|
||||
const source = readFileSync(join(process.cwd(), "packages/pi-coding-agent/src/core/keybindings.ts"), "utf-8");
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import assert from "node:assert/strict";
|
|||
import { mkdtempSync, mkdirSync, rmSync, writeFileSync, existsSync } from "node:fs";
|
||||
import { homedir, tmpdir } from "node:os";
|
||||
import { join, resolve } from "node:path";
|
||||
import { describe, it } from "node:test";
|
||||
import { describe, it } from 'vitest';
|
||||
import {
|
||||
readManifestRuntimeDeps,
|
||||
collectRuntimeDependencies,
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
* Run: node --experimental-strip-types --test src/core/lsp/lsp-integration.test.ts
|
||||
* (from packages/pi-coding-agent/)
|
||||
*/
|
||||
import test from "node:test";
|
||||
import { test } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import { spawn } from "node:child_process";
|
||||
import * as fs from "node:fs";
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
* containing an lsp.json that uses the legacy key.
|
||||
*/
|
||||
|
||||
import { describe, it, beforeEach, afterEach } from "node:test";
|
||||
import { describe, it, beforeEach, afterEach } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import * as fs from "node:fs";
|
||||
import * as path from "node:path";
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
* user-typed input when converted to LLM messages.
|
||||
*/
|
||||
|
||||
import test from "node:test";
|
||||
import { test } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import { convertToLlm, type CustomMessage } from "./messages.js";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import assert from "node:assert/strict";
|
||||
import { describe, it } from "node:test";
|
||||
import { describe, it } from 'vitest';
|
||||
import {
|
||||
DISCOVERY_TTLS,
|
||||
getDefaultTTL,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import assert from "node:assert/strict";
|
||||
import { describe, it } from "node:test";
|
||||
import { describe, it } from 'vitest';
|
||||
import type { Api, Model, SimpleStreamOptions, Context, AssistantMessageEventStream } from "@singularity-forge/pi-ai";
|
||||
import { getApiProvider } from "@singularity-forge/pi-ai";
|
||||
import { AuthStorage, type AuthStorageData } from "./auth-storage.js";
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import assert from "node:assert/strict";
|
|||
import { mkdirSync, rmSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
import { afterEach, beforeEach, describe, it } from "node:test";
|
||||
import { afterEach, beforeEach, describe, it } from 'vitest';
|
||||
import { AuthStorage } from "./auth-storage.js";
|
||||
import { ModelDiscoveryCache } from "./discovery-cache.js";
|
||||
import {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import assert from "node:assert/strict";
|
||||
import { describe, it } from "node:test";
|
||||
import { describe, it } from 'vitest';
|
||||
import type { AuthStorage } from "./auth-storage.js";
|
||||
import { ModelRegistry } from "./model-registry.js";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import assert from "node:assert/strict";
|
||||
import { describe, it } from "node:test";
|
||||
import { describe, it } from 'vitest';
|
||||
import type { Api, AssistantMessageEventStream, Context, Model, SimpleStreamOptions } from "@singularity-forge/pi-ai";
|
||||
import type { AuthStorage } from "./auth-storage.js";
|
||||
import { ModelRegistry } from "./model-registry.js";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import assert from "node:assert/strict";
|
||||
import { describe, it } from "node:test";
|
||||
import { describe, it } from 'vitest';
|
||||
import type { Api, Model } from "@singularity-forge/pi-ai";
|
||||
import type { ModelRegistry } from "./model-registry.js";
|
||||
import { findInitialModel } from "./model-resolver.js";
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* "current".
|
||||
*/
|
||||
|
||||
import test from "node:test";
|
||||
import { test } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import { findInitialModel } from "./model-resolver.js";
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import assert from "node:assert/strict";
|
|||
import { existsSync, mkdirSync, readFileSync, rmSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
import { afterEach, beforeEach, describe, it } from "node:test";
|
||||
import { afterEach, beforeEach, describe, it } from 'vitest';
|
||||
import { ModelsJsonWriter } from "./models-json-writer.js";
|
||||
|
||||
let testDir: string;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { existsSync, mkdtempSync, mkdirSync, readFileSync, rmSync, writeFileSync
|
|||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
import { Writable } from "node:stream";
|
||||
import { describe, it } from "node:test";
|
||||
import { describe, it } from 'vitest';
|
||||
import { runPackageCommand } from "./package-commands.js";
|
||||
|
||||
function createCaptureStream() {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { describe, it, beforeEach, afterEach } from "node:test";
|
||||
import { describe, it, beforeEach, afterEach } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import {
|
||||
resolveConfigValue,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// SF — Regression test for #3616: reload() must reset jiti extension loader cache
|
||||
// Copyright (c) 2026 Jeremy McSpadden <jeremy@fluxlabs.net>
|
||||
|
||||
import test, { describe } from "node:test";
|
||||
import { test, describe } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
* downgrade from [1m] to base when no cross-provider fallback exists.
|
||||
*/
|
||||
|
||||
import { describe, it, beforeEach, mock, type Mock } from "node:test";
|
||||
import { vi, describe, it, beforeEach, type Mock } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import { RetryHandler, type RetryHandlerDeps } from "./retry-handler.js";
|
||||
import type { Api, AssistantMessage, Model } from "@singularity-forge/pi-ai";
|
||||
|
|
@ -69,13 +69,13 @@ function createMockDeps(overrides?: {
|
|||
}): MockDeps {
|
||||
const model = overrides?.model ?? createMockModel("anthropic", "claude-opus-4-6[1m]");
|
||||
const emittedEvents: Array<Record<string, any>> = [];
|
||||
const continueFn = mock.fn(async () => {});
|
||||
const onModelChangeFn = mock.fn((_model: Model<any>) => {});
|
||||
const markUsageLimitReached = mock.fn(
|
||||
const continueFn = vi.fn(async () => {});
|
||||
const onModelChangeFn = vi.fn((_model: Model<any>) => {});
|
||||
const markUsageLimitReached = vi.fn(
|
||||
() => overrides?.markUsageLimitReachedResult ?? false,
|
||||
);
|
||||
const findFallback = mock.fn(async () => overrides?.fallbackResult ?? null);
|
||||
const findModel = mock.fn(
|
||||
const findFallback = vi.fn(async () => overrides?.fallbackResult ?? null);
|
||||
const findModel = vi.fn(
|
||||
overrides?.findModelResult ?? ((_provider: string, _modelId: string) => undefined),
|
||||
);
|
||||
|
||||
|
|
@ -85,8 +85,8 @@ function createMockDeps(overrides?: {
|
|||
agent: {
|
||||
continue: continueFn,
|
||||
state: { messages },
|
||||
setModel: mock.fn(),
|
||||
replaceMessages: mock.fn((newMessages: any[]) => {
|
||||
setModel: vi.fn(),
|
||||
replaceMessages: vi.fn((newMessages: any[]) => {
|
||||
messages.length = 0;
|
||||
messages.push(...newMessages);
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// pi-coding-agent / CredentialCooldownError unit tests
|
||||
// Copyright (c) 2026 Jeremy McSpadden <jeremy@fluxlabs.net>
|
||||
|
||||
import { describe, it } from "node:test";
|
||||
import { describe, it } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import { CredentialCooldownError } from "./sdk.js";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import assert from "node:assert/strict";
|
||||
import { describe, it, afterEach } from "node:test";
|
||||
import { describe, it, afterEach } from 'vitest';
|
||||
import { mkdtempSync, rmSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
import { tmpdir } from "node:os";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { describe, it, afterEach } from "node:test";
|
||||
import { describe, it, afterEach } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import { mkdtempSync, mkdirSync, writeFileSync, rmSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import assert from "node:assert/strict";
|
|||
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
import { afterEach, beforeEach, describe, it } from "node:test";
|
||||
import { afterEach, beforeEach, describe, it } from 'vitest';
|
||||
|
||||
import { Agent } from "@singularity-forge/pi-agent-core";
|
||||
import { AuthStorage } from "./auth-storage.js";
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
* the command does not already redirect stdout.
|
||||
*/
|
||||
|
||||
import { describe, it } from "node:test";
|
||||
import { describe, it } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import { rewriteBackgroundCommand } from "./bash.js";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { describe, it } from "node:test";
|
||||
import { describe, it } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import {
|
||||
checkBashInterception,
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
* See: singularity-forge/sf-run#XXXX
|
||||
*/
|
||||
|
||||
import test from "node:test";
|
||||
import { test } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import { spawn } from "node:child_process";
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import assert from "node:assert/strict";
|
|||
import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
import { describe, it } from "node:test";
|
||||
import { describe, it } from 'vitest';
|
||||
|
||||
import {
|
||||
computeEditDiff,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { describe, it } from "node:test";
|
||||
import { describe, it } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import {
|
||||
computeLineHash,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { describe, it, mock, afterEach } from "node:test";
|
||||
import { describe, it, afterEach } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import { mkdtempSync, writeFileSync, symlinkSync, unlinkSync, rmdirSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
* Fixes: singularity-forge/sf-run#2854
|
||||
*/
|
||||
|
||||
import test from "node:test";
|
||||
import { test } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { join, dirname, relative } from "node:path";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { describe, test } from "node:test";
|
||||
import { describe } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import { buildAuthUrlPresentation } from "../login-dialog.js";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// SF — Provider display name mapping tests
|
||||
import { test, describe } from "node:test";
|
||||
import { describe } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import { providerDisplayName } from "../model-selector.js";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { test, describe } from "node:test";
|
||||
import { describe } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import { formatTimestamp } from "../timestamp.js";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { describe, test } from "node:test";
|
||||
import { describe } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import stripAnsi from "strip-ansi";
|
||||
import { ToolExecutionComponent } from "../tool-execution.js";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import assert from "node:assert/strict";
|
||||
import { describe, it, mock } from "node:test";
|
||||
import { describe, it } from 'vitest';
|
||||
|
||||
import { DynamicBorder } from "./dynamic-border.js";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
import { test } from 'vitest';
|
||||
|
||||
import { findLatestPinnableText } from "./chat-controller.js";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
import { test } from 'vitest';
|
||||
|
||||
import { setupEditorSubmitHandler } from "./input-controller.js";
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
* mock child processes using PassThrough streams.
|
||||
*/
|
||||
|
||||
import { describe, it, beforeEach, afterEach, mock } from "node:test";
|
||||
import { describe, it, beforeEach, afterEach } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import { PassThrough } from "node:stream";
|
||||
import { attachJsonlLineReader, serializeJsonLine } from "./jsonl.js";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import assert from "node:assert/strict";
|
||||
import { describe, it, afterEach } from "node:test";
|
||||
import { describe, it, afterEach } from 'vitest';
|
||||
import { mkdtempSync, rmSync, readFileSync, existsSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
import { tmpdir } from "node:os";
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* the system prompt builder produces forward-slash paths for LLM consumption.
|
||||
*/
|
||||
|
||||
import test from "node:test";
|
||||
import { test } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import { toPosixPath } from "../utils/path-display.js";
|
||||
import { buildSystemPrompt } from "../core/system-prompt.js";
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
// filter lets consumers narrow the <available_skills> catalog rendered into
|
||||
// the cached system prompt without touching skill loading or invocation.
|
||||
|
||||
import test from "node:test";
|
||||
import { test } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
|
||||
import { buildSystemPrompt } from "../core/system-prompt.js";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { describe, it } from "node:test";
|
||||
import { describe, it } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import { CombinedAutocompleteProvider } from "../autocomplete.js";
|
||||
import type { SlashCommand } from "../autocomplete.js";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { describe, it } from "node:test";
|
||||
import { describe, it } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import { fuzzyMatch, fuzzyFilter } from "../fuzzy.js";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// pi-tui — Overlay Layout Tests (backdrop dimming)
|
||||
|
||||
import { describe, it } from "node:test";
|
||||
import { describe, it } from 'vitest';
|
||||
import assert from "node:assert/strict";
|
||||
import { compositeOverlays, type OverlayEntry } from "../overlay-layout.js";
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue