-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Expand file tree
/
Copy pathrunner-config-path.ts
More file actions
33 lines (29 loc) · 1.02 KB
/
runner-config-path.ts
File metadata and controls
33 lines (29 loc) · 1.02 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
import assert from 'node:assert/strict';
import path from 'node:path';
import { writeMultipleFiles } from '../../utils/fs';
import { ng } from '../../utils/process';
import { applyVitestBuilder } from '../../utils/vitest';
export default async function (): Promise<void> {
await applyVitestBuilder();
// Create a custom Vitest configuration file.
const customConfigPath = 'vitest.custom.mjs';
await writeMultipleFiles({
[customConfigPath]: `
import { defineConfig } from 'vitest/config';
export default defineConfig({
test: {
// A unique option to confirm this file is being used.
passWithNoTests: true,
},
});
`,
});
const absoluteConfigPath = path.resolve(customConfigPath);
const { stdout } = await ng('test', `--runner-config=${absoluteConfigPath}`);
// Assert that the CLI logs the use of the specified configuration file.
assert.match(
stdout,
/vitest\.custom\.mjs/,
'Expected a message confirming the use of the custom config file.',
);
}