# vitest.config.ts

> 38 lines of code and 5 definitions.

Tree: Codebase Testing
Language: typescript
Canonical: https://banes-lab.com/anatomy/testing#file-testing-vitest-config-ts
Source text: https://banes-lab.com/source/testing/vitest.config.ts.txt

Listed in [Codebase Testing](https://banes-lab.com/api/source/testing.md), after [tsconfig.json](https://banes-lab.com/source/testing/tsconfig.json.md) and before [tsconfig.base.json](https://banes-lab.com/source/testing/tsconfig.base.json.md).

## Definitions

- `TESTS` (lexical_declaration, line 5)
- `WEB_TESTS` (lexical_declaration, line 6)
- `WEB_SETUP` (lexical_declaration, line 7)
- `SOCIAL_TESTS` (lexical_declaration, line 8)
- `DOCUMENT_TESTS` (lexical_declaration, line 9)

## Contained in

- [root](https://banes-lab.com/anatomy/testing/folder-testing.md)

## Source

```typescript
import { defineConfig } from "vitest/config";
import { fileURLToPath } from "node:url";
import { relativePath } from "@ssot/paths";

const TESTS = relativePath("codebase.testing");
const WEB_TESTS = relativePath("codebase.testing.app");
const WEB_SETUP = [`${WEB_TESTS}/core/loaders/stylesheet.fixture.ts`];
const SOCIAL_TESTS = relativePath("codebase.testing.social");
const DOCUMENT_TESTS = [`${SOCIAL_TESTS}/core/renderers/**/*.test.ts`, `${SOCIAL_TESTS}/core/timers/**/*.test.ts`];

export default defineConfig({
    root: fileURLToPath(new URL("../", import.meta.url)),
    test: {
        globals: false,
        hookTimeout: 30_000,
        projects: [
            {
                extends: true,
                test: {
                    environment: "node",
                    exclude: [`${WEB_TESTS}/**`, ...DOCUMENT_TESTS],
                    include: [`${TESTS}/**/*.test.ts`],
                    name: "node",
                },
            },
            { extends: true, test: { environment: "jsdom", include: DOCUMENT_TESTS, name: "stage" } },
            {
                extends: true,
                test: {
                    environment: "jsdom",
                    include: [`${WEB_TESTS}/**/*.test.ts`],
                    name: "web",
                    setupFiles: WEB_SETUP,
                },
            },
        ],
        reporters: ["default"],
        testTimeout: 30_000,
    },
});
```
