From 2945c2e4d0a4b6be7a6c922dc7b8189727abb3d5 Mon Sep 17 00:00:00 2001 From: Michael D'Angelo <269034524+mldangelo-oai@users.noreply.github.com> Date: Mon, 26 Oct 2026 14:11:30 +0000 Subject: [PATCH] test(sdk): query severity fixtures in Bun --- .../tests-ts/classify-scan-severity.test.ts | 20 +++++-------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/sdk/typescript/tests-ts/classify-scan-severity.test.ts b/sdk/typescript/tests-ts/classify-scan-severity.test.ts index 6bb4e0a8c0..abe7c5b35a 100644 --- a/sdk/typescript/tests-ts/classify-scan-severity.test.ts +++ b/sdk/typescript/tests-ts/classify-scan-severity.test.ts @@ -20,6 +20,7 @@ import { classifySeverity, type ClassifySeverityOptions, } from "../src/classify-severity.js"; +import { Database } from "bun:sqlite"; import { loadContract } from "../src/contract.js"; import type { JsonObject } from "../src/config.js"; import type { Finding, FindingsDocument, ScanManifest } from "../src/models.js"; @@ -151,22 +152,11 @@ function classifier(finding: Finding, excluded = false) { } async function query(environment: NodeJS.ProcessEnv, sql: string) { - const result = spawnSync( - Bun.which("node")!, - [ - "--input-type=module", - "--eval", - `import { DatabaseSync } from "node:sqlite"; -const database = new DatabaseSync(process.argv[1]); -try { console.log(JSON.stringify(database.prepare(process.argv[2]).all())); } -finally { database.close(); }`, - join(environment["CODEX_SECURITY_STATE_DIR"]!, "workbench.sqlite3"), - sql, - ], - { encoding: "utf8", env: environment }, + using database = new Database( + join(environment["CODEX_SECURITY_STATE_DIR"]!, "workbench.sqlite3"), ); - expect(result.status, result.stderr).toBe(0); - return JSON.parse(result.stdout) as Record[]; + database.run("PRAGMA foreign_keys = ON"); + return database.query, []>(sql).all(); } test("classification and saved assessments run with Node and no Python", async () => {