-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathvitest.config.js
More file actions
57 lines (55 loc) · 1.73 KB
/
Copy pathvitest.config.js
File metadata and controls
57 lines (55 loc) · 1.73 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
56
57
import { defineConfig } from 'vitest/config';
import path from 'node:path';
import { storybookTest } from '@storybook/addon-vitest/vitest-plugin';
import { playwright } from '@vitest/browser-playwright';
const dirname = import.meta.dirname;
// More info at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon
export default defineConfig({
test: {
coverage: {
reportsDirectory: './test/unit-test-coverage',
include: ['**/packages/**/src/**/*.js'],
exclude: ['**/*.{scss,css}'],
},
projects: [
{
extends: true,
test: {
// Naming this test so it can run on its own with `vitest --project-unit `
// this skips the slower browser project, and so it will be labeled
// `|unit|` instead of `|0|` in test output.
name: 'unit',
globals: true,
environment: 'jsdom',
setupFiles: './test/vitest.setup.js',
include: ['packages/**/*.spec.js'],
// Handle the CSS imports that are in JS files:
css: true,
},
},
{
extends: true,
plugins: [
// The plugin will run tests for the stories defined in your Storybook config
// See options at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon#storybooktest
storybookTest({
configDir: path.join(dirname, '.storybook'),
}),
],
test: {
name: 'storybook',
browser: {
enabled: true,
headless: true,
provider: playwright({}),
instances: [
{
browser: 'chromium',
},
],
},
},
},
],
},
});