Organize test files

This commit is contained in:
Formsmith
2026-06-14 22:13:39 +03:00
parent 753a1c2833
commit 4ba8cb723c
7 changed files with 17 additions and 11 deletions
+3 -3
View File
@@ -8,9 +8,9 @@
"export": "set STATIC_EXPORT=true&& next build apps/web",
"start": "next start apps/web",
"typecheck": "tsc -p apps/web/tsconfig.json --noEmit",
"test": "vitest run",
"test:watch": "vitest",
"perf": "vitest run --config vitest.perf.config.ts --reporter verbose",
"test": "vitest run --config tests/vitest.config.ts",
"test:watch": "vitest --config tests/vitest.config.ts",
"perf": "vitest run --config tests/vitest.perf.config.ts --reporter verbose",
"ci": "npm run typecheck && npm run test"
},
"dependencies": {
@@ -174,7 +174,7 @@ function printReport(rows: BenchRow[]) {
describe("STL performance benchmark", () => {
it("measures import and local-first persistence costs", async () => {
const rows: BenchRow[] = [];
const stlModule = await measure(rows, "startup", "load STL import module", 1, {}, () => import("../lib/stlImport"));
const stlModule = await measure(rows, "startup", "load STL import module", 1, {}, () => import("@/lib/stlImport"));
const importedShapeFromStl = stlModule.importedShapeFromStl as ImportedShapeFromStl;
for (const workload of SYNTHETIC_WORKLOADS) {
@@ -1,6 +1,6 @@
import { describe, expect, it } from "vitest";
import type { ShapeAsset } from "@/types/sketchforge";
import { makeShapeFromAsset, sceneShape, toolbarShapeAssets } from "./shapeCatalog";
import { makeShapeFromAsset, sceneShape, toolbarShapeAssets } from "@/lib/shapeCatalog";
describe("shape catalog", () => {
it("does not expose removed decorative shapes in the toolbar catalog", () => {
@@ -1,6 +1,6 @@
import { describe, expect, it } from "vitest";
import type { WorkplaneWorkspaceSettings } from "@/types/sketchforge";
import { DEFAULT_SNAP_GRID, DEFAULT_WORKPLANE_WORKSPACE, normalizeSnapGrid, normalizeWorkspaceSettings, workplaneSettingsFingerprint } from "./workplaneSettings";
import { DEFAULT_SNAP_GRID, DEFAULT_WORKPLANE_WORKSPACE, normalizeSnapGrid, normalizeWorkspaceSettings, workplaneSettingsFingerprint } from "@/lib/workplaneSettings";
describe("workplane settings helpers", () => {
it("accepts known snap grid values and falls back for unknown values", () => {
@@ -14,7 +14,7 @@ import {
shapeDepth,
shapeWidth,
workplaneShapesEqual,
} from "./workplaneShapes";
} from "@/lib/workplaneShapes";
function shape(overrides: Partial<WorkplaneShape> = {}): WorkplaneShape {
return {
+5 -2
View File
@@ -1,14 +1,17 @@
import path from "node:path";
import { defineConfig } from "vitest/config";
const rootDir = path.resolve(__dirname, "..");
export default defineConfig({
root: rootDir,
resolve: {
alias: {
"@": path.resolve(__dirname, "apps/web/src"),
"@": path.resolve(rootDir, "apps/web/src"),
},
},
test: {
environment: "node",
include: ["apps/web/src/**/*.test.ts"],
include: ["tests/unit/**/*.test.ts"],
},
});
@@ -1,15 +1,18 @@
import path from "node:path";
import { defineConfig } from "vitest/config";
const rootDir = path.resolve(__dirname, "..");
export default defineConfig({
root: rootDir,
resolve: {
alias: {
"@": path.resolve(__dirname, "apps/web/src"),
"@": path.resolve(rootDir, "apps/web/src"),
},
},
test: {
environment: "node",
include: ["apps/web/src/perf/**/*.perf.ts"],
include: ["tests/perf/**/*.perf.ts"],
testTimeout: 120000,
hookTimeout: 120000,
},