tests: fix node tests + add connection test suite for sqlocal

This commit is contained in:
dswbx
2025-12-02 14:11:26 +01:00
parent e56fc9c368
commit 731b7a7e8d
4 changed files with 26 additions and 21 deletions

View File

@@ -1,4 +1,4 @@
import { describe, beforeAll, afterAll } from "vitest";
import { describe } from "vitest";
import * as node from "./node.adapter";
import { adapterTestSuite } from "adapter/adapter-test-suite";
import { viTestRunner } from "adapter/node/vitest";

View File

@@ -0,0 +1,15 @@
import { describe } from "bun:test";
import { SQLocalConnection } from "./SQLocalConnection";
import { connectionTestSuite } from "data/connection/connection-test-suite";
import { bunTestRunner } from "adapter/bun/test";
import { SQLocalKysely } from "sqlocal/kysely";
describe("SQLocalConnection", () => {
connectionTestSuite(bunTestRunner, {
makeConnection: () => ({
connection: new SQLocalConnection(new SQLocalKysely({ databasePath: ":memory:" })),
dispose: async () => {},
}),
rawDialectDetails: [],
});
});

View File

@@ -1,5 +1,7 @@
import { Kysely, ParseJSONResultsPlugin } from "kysely";
import { SqliteConnection, SqliteIntrospector, type DB } from "bknd";
import { SqliteConnection } from "../SqliteConnection";
import { SqliteIntrospector } from "../SqliteIntrospector";
import type { DB } from "bknd";
import type { SQLocalKysely } from "sqlocal/kysely";
const plugins = [new ParseJSONResultsPlugin()];

View File

@@ -1,26 +1,14 @@
import { defineConfig } from "vitest/config";
import react from "@vitejs/plugin-react";
import tsconfigPaths from "vite-tsconfig-paths";
import path from "node:path";
export default defineConfig({
plugins: [tsconfigPaths()],
plugins: [
tsconfigPaths({
root: ".",
ignoreConfigErrors: true,
}) as any,
],
test: {
projects: ["**/*.vitest.config.ts", "**/*/vitest.config.ts"],
include: ["**/*.vi-test.ts", "**/*.vitest.ts"],
},
});
// export defineConfig({
// plugins: [tsconfigPaths()],
// test: {
// globals: true,
// environment: "jsdom",
// setupFiles: ["./__test__/vitest/setup.ts"],
// include: ["**/*.vi-test.ts", "**/*.vitest.ts"],
// coverage: {
// provider: "v8",
// reporter: ["text", "json", "html"],
// exclude: ["node_modules/", "**/*.d.ts", "**/*.test.ts", "**/*.config.ts"],
// },
// },
// });