forked from TryGhost/Ghost
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvitest.config.mjs
More file actions
34 lines (33 loc) · 1.68 KB
/
vitest.config.mjs
File metadata and controls
34 lines (33 loc) · 1.68 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
import path from 'node:path';
import {defineConfig} from 'vitest/config';
// Root Vitest config — a single watcher across every Vitest-based package in
// the monorepo. `pnpm test:watch` runs this. Each package is a project that
// keeps its own config (environment, setup, pool); scope to one with a path
// filter, e.g. `pnpm test:watch apps/posts`.
//
// Not included: ghost/i18n and ghost/parse-email-address (still on Mocha) and
// ghost-admin (Ember QUnit). admin-x-activitypub is a dead directory with no
// package.json or test config. signup-form has no Vitest unit tests (its
// test:unit is a build; test/unit holds only an empty placeholder).
export default defineConfig({
test: {
projects: [
'ghost/core',
'apps/*',
'!apps/admin-x-activitypub',
'!apps/signup-form'
],
// ghost/core's snapshot tests use @tryghost/jest-snapshot, which
// manages its own __snapshots__/*.snap files. Vitest's native
// snapshot system would otherwise adopt and rewrite them (down to the
// header). The project-level resolveSnapshotPath in
// ghost/core/vitest.config.ts is not honored once projects run under
// this root config, so redirect ghost/core's native snapshots to a
// never-written path here. App projects keep the default location.
resolveSnapshotPath: (testPath, snapExtension) => {
const isGhostCore = testPath.includes(`${path.sep}ghost${path.sep}core${path.sep}`);
const dir = isGhostCore ? '__vitest_snapshots__' : '__snapshots__';
return path.join(path.dirname(testPath), dir, path.basename(testPath) + snapExtension);
}
}
});