-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.config.ts
More file actions
54 lines (52 loc) · 1.77 KB
/
vitest.config.ts
File metadata and controls
54 lines (52 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/// <reference types="vitest" />
import { defineConfig } from "vitest/config";
import react from "@vitejs/plugin-react";
import { fileURLToPath } from "node:url";
const root = fileURLToPath(new URL("./", import.meta.url));
/**
* Vitest configuration for DataLab-Web.
*
* Two test suites live side-by-side:
*
* - ``tests/ts/`` → fast unit tests of TypeScript modules that do
* **not** need Pyodide (action registry, menu
* building, theme helpers, trust store, …).
* - ``tests/pyodide/`` → smoke tests that boot a real Pyodide instance
* under Node and exercise the bridge end-to-end
* (kept opt-in via ``--project pyodide``).
*
* The default ``npm test`` only runs the ``ts`` project to keep CI fast.
*/
export default defineConfig({
root,
plugins: [react()],
resolve: {
extensions: [".ts", ".tsx", ".js", ".jsx", ".json"],
},
// Same Vite plumbing as the app, so ``?raw`` imports of .py files work
// when components/runtime modules are imported transitively.
assetsInclude: ["**/*.py"],
test: {
environment: "jsdom",
globals: true,
include: ["tests/ts/**/*.test.{ts,tsx}"],
setupFiles: ["tests/ts/setup.ts"],
coverage: {
provider: "v8",
reporter: ["text", "html", "lcov"],
reportsDirectory: "coverage-ts",
include: ["src/**/*.{ts,tsx}"],
exclude: [
"src/**/*.d.ts",
"src/main.tsx",
// Python sources are tested under pytest.
"src/runtime/**/*.py",
// Pyodide-side runtime cannot be exercised in jsdom.
"src/runtime/runtime.ts",
"src/runtime/macroWorker.ts",
"src/runtime/MacroRuntime.ts",
"src/runtime/RuntimeContext.tsx",
],
},
},
});