Repository navigation
Expand file tree
/
Copy pathvitest.config.mts
More file actions
55 lines (52 loc) · 2.22 KB
/
Copy pathvitest.config.mts
File metadata and controls
55 lines (52 loc) · 2.22 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
55
/*
* This file belongs to Hoist, an application development toolkit
* developed by Extremely Heavy Industries (www.xh.io | info@xh.io)
*
* Copyright © 2026 Extremely Heavy Industries Inc.
*/
import configureVitest from '@xh/hoist-dev-utils/configureVitest';
import {configDefaults, defineConfig, mergeConfig} from 'vitest/config';
/**
* Vitest config for hoist-react's unit tests. See docs/unit-testing.md.
*
* Built on the same `configureVitest()` preset that apps use, so this suite checks the preset's
* compiler, `XH` constants and test defaults on every PR. `selfHost` aliases `@xh/hoist` to this
* repo and loads `test-support/setup.ts` from it.
*/
const isCI = !!process.env.CI,
// Writes the run summary and HTML report to .vitest/report - see
// test-support/report/TestReporter.ts.
reportReporter = './test-support/report/TestReporter.ts';
export default defineConfig(
mergeConfig(
configureVitest({
selfHost: true,
appCode: 'testApp',
// Specs assert on these, via XH and the fake hoist-core's environment.
appVersion: '1.0.0',
appBuild: 'test',
include: ['**/*.spec.ts']
}),
{
test: {
// Dot-directories are excluded so a run from the main checkout never collects specs
// from worktrees under .claude/.
exclude: [...configDefaults.exclude, 'build/**', '.*/**'],
// Record each test's line number, for links from reports to the spec source.
includeTaskLocation: true,
// Show values interpolated into it.each() test names in full - they describe the
// case.
taskTitleValueFormatTruncate: 1000,
// In CI, annotate failures inline on the PR diff and write a report of the run. The
// report replaces the github-actions reporter's own (counts-only) job summary.
reporters: isCI
? [
'default',
['github-actions', {jobSummary: {enabled: false}}],
reportReporter
]
: ['default']
}
}
)
);