@seahax/vitest
v0.1.8
Published
Vitest config helpers.
Readme
@seahax/vitest
Vitest config helpers.
Test Config
- Pass with no tests.
- Pin the timezone to UTC.
- Restores all mocks after each test (not before).
- Enables real timers after each test (not before).
File: vitest.config.ts
import { testDefaults } from '@seahax/vitest';
import { defineConfig } from 'vitest/config';
export default defineConfig({
test: {
...testDefaults,
// Additional test options...
}
});Workspace Config
- Automatically detect workspace directory globs from
pnpm-workspace.yamlorpackage.json(optional). - Find all
vitest.config.*files in workspace directories.
Vitest doesn't normally require a vitest.config.* file to be present in each workspace directory. This utility enforces the config file requirement so that: a) testing a package can be disabled by omitting the config file, or b) multiple test configurations can be defined for a single package by creating multiple config files.
File: vitest.workspace.ts
import { defineWorkspace } from '@seahax/vitest';
export default defineWorkspace();Workspace directory globs can also be provided manually.
export default defineWorkspace(['packages/*']);