2026-06-04 15:16:53 -04:00
|
|
|
import path from "path";
|
|
|
|
|
import { defineConfig } from "vitest/config";
|
|
|
|
|
|
|
|
|
|
export default defineConfig({
|
|
|
|
|
resolve: {
|
2026-10-01 16:20:16 -05:00
|
|
|
alias: [
|
|
|
|
|
{
|
2026-10-10 14:58:27 -05:00
|
|
|
find: "@termix-ssh/plugin-sdk/frontend",
|
2026-10-01 16:20:16 -05:00
|
|
|
replacement: path.resolve(
|
|
|
|
|
__dirname,
|
|
|
|
|
"./packages/plugin-sdk/src/frontend.ts",
|
|
|
|
|
),
|
|
|
|
|
},
|
|
|
|
|
{
|
2026-10-10 14:58:27 -05:00
|
|
|
find: "@termix-ssh/plugin-sdk/ui",
|
2026-10-01 16:20:16 -05:00
|
|
|
replacement: path.resolve(__dirname, "./src/ui/plugin-host/sdk-ui.ts"),
|
|
|
|
|
},
|
|
|
|
|
{
|
2026-10-10 14:58:27 -05:00
|
|
|
find: "@termix-ssh/plugin-host/testing",
|
2026-10-01 16:20:16 -05:00
|
|
|
replacement: path.resolve(
|
|
|
|
|
__dirname,
|
|
|
|
|
"./src/ui/plugin-host/testing-host.tsx",
|
|
|
|
|
),
|
|
|
|
|
},
|
|
|
|
|
{ find: "@/types", replacement: path.resolve(__dirname, "./src/types") },
|
|
|
|
|
{ find: "@", replacement: path.resolve(__dirname, "./src/ui") },
|
|
|
|
|
],
|
2026-06-04 15:16:53 -04:00
|
|
|
},
|
|
|
|
|
test: {
|
|
|
|
|
globals: true,
|
|
|
|
|
setupFiles: ["./vitest.setup.ts"],
|
2026-10-10 14:58:27 -05:00
|
|
|
// Forks workers on Windows abort now and then (0xC0000409) in a random
|
|
|
|
|
// file and Vitest reports "Worker exited unexpectedly". Threads don't.
|
|
|
|
|
pool: "threads",
|
2026-06-04 15:16:53 -04:00
|
|
|
coverage: {
|
|
|
|
|
provider: "v8",
|
|
|
|
|
reporter: ["text", "html"],
|
|
|
|
|
reportsDirectory: "./coverage",
|
|
|
|
|
exclude: [
|
|
|
|
|
"**/node_modules/**",
|
|
|
|
|
"**/dist/**",
|
|
|
|
|
"**/coverage/**",
|
|
|
|
|
"electron/**",
|
|
|
|
|
"scripts/**",
|
|
|
|
|
"**/*.config.*",
|
|
|
|
|
"**/*.test.{ts,tsx}",
|
|
|
|
|
"src/backend/test-helpers/**",
|
|
|
|
|
"src/ui/locales/**",
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
projects: [
|
|
|
|
|
{
|
|
|
|
|
extends: true,
|
|
|
|
|
test: {
|
|
|
|
|
name: "backend",
|
|
|
|
|
environment: "node",
|
|
|
|
|
include: ["src/backend/**/*.test.ts"],
|
2026-08-06 14:41:39 -05:00
|
|
|
// The repository tests can be pointed at a real Postgres or MySQL
|
|
|
|
|
// (TEST_DIALECT). Connecting, migrating and clearing tables between
|
|
|
|
|
// tests costs seconds there, against microseconds for in-memory
|
|
|
|
|
// SQLite, so the default timeout only fits the SQLite run.
|
|
|
|
|
testTimeout: process.env.TEST_DIALECT ? 60_000 : 5_000,
|
|
|
|
|
hookTimeout: process.env.TEST_DIALECT ? 60_000 : 10_000,
|
2026-06-04 15:16:53 -04:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
extends: true,
|
|
|
|
|
test: {
|
|
|
|
|
name: "frontend",
|
|
|
|
|
environment: "jsdom",
|
|
|
|
|
include: ["src/ui/**/*.test.{ts,tsx}"],
|
2026-10-01 16:20:16 -05:00
|
|
|
// The CLI bundle test builds under node_modules; inline it so its
|
|
|
|
|
// SDK imports hit the aliases instead of a second copy of the SDK.
|
|
|
|
|
server: { deps: { inline: [/cli-bundle-test/] } },
|
2026-06-04 15:16:53 -04:00
|
|
|
},
|
|
|
|
|
},
|
2026-06-16 15:59:53 -05:00
|
|
|
{
|
|
|
|
|
extends: true,
|
|
|
|
|
test: {
|
|
|
|
|
name: "scripts",
|
|
|
|
|
environment: "node",
|
|
|
|
|
include: ["scripts/**/*.test.ts"],
|
|
|
|
|
},
|
|
|
|
|
},
|
2026-06-04 15:16:53 -04:00
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
});
|