# @theorchard/vitest-config

Default Vitest configuration for frontend apps.

**Note** that the configuration targets `*.vitest.ts[x]` files by default.
This is done to make it easier to add vitest to existing jest configured repos.

## Usage with frontend-cli

Create a `vite.config.ts` in your repo root with the following:

```ts
import { getConfig } from '@theorchard/frontend-cli-vite';
import { defineConfig } from '@theorchard/vitest-config';

export default async () => {
    const config = await getConfig();

    return await defineConfig(config);
};
```

### Overriding configuration

```ts
import { getConfig } from '@theorchard/frontend-cli-vite';
import { defineConfig } from '@theorchard/vitest-config';

export default async () => {
    const config = await getConfig();

    return await defineConfig({
        ...config,
        test: {
            // target spec.ts[x] instead of vitest.ts[x]
            include: ['**/__tests__/*.spec.?(c|m)[jt]s?(x)'],
            // do not define global "test", "describe" and "expect" functions,
            // instead do: `import { describe } from 'vitest'`.
            global: false,

            // find all vitest options here:
            // https://vitest.dev/config/#options
        },
    });
};
```

## Usage without frontend-cli

Create a `vitest.config.ts` in your repo root with the following:

```ts
import { defineConfig } from '@theorchard/vitest-config';

export default defineConfig({
    test: {
        // custom config options
    },
});
```
