Skip to content

Commit 2dfbb04

Browse files
committed
refactor(vite): Use correct defineConfig from vitest for vitest configuration. Remove deprecated config.
Vitest provides its own defineConfig that should be used when creating test configuration in `vite.config.js`. Convert `environmentMatchGlobs` to `projects`, since the former has been deprecated Signed-off-by: Drew Hoener <[email protected]>
1 parent dc01380 commit 2dfbb04

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

vite.config.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { resolve } from 'path'
2-
import { defineConfig } from 'vite'
2+
import { defineConfig } from 'vitest/config'
33
import dts from 'vite-plugin-dts';
44
import checker from 'vite-plugin-checker';
55

@@ -22,7 +22,7 @@ export default defineConfig({
2222
build: {
2323
lib: {
2424
// Could also be a dictionary or array of multiple entry points
25-
entry: resolve(__dirname, 'src/RosLib.js'),
25+
entry: resolve(__dirname, 'src/RosLib.ts'),
2626
name: 'ROSLIB',
2727
// the proper extensions will be added
2828
fileName: 'RosLib',
@@ -38,13 +38,18 @@ export default defineConfig({
3838
},
3939
test: {
4040
include: [
41-
'{src,test}/**\/*.{test,spec}.?(c|m)[jt]s?(x)',
41+
'{src,test}/**/*.{test,spec}.?(c|m)[jt]s?(x)',
4242
'./test/examples/*.js',
4343
],
4444
exclude: ['dist'],
45-
environmentMatchGlobs: [
46-
// React example requires DOM emulation
47-
['examples/react-example/**', 'jsdom']
45+
projects: [
46+
{
47+
extends: true,
48+
test: {
49+
environment: 'jsdom',
50+
name: 'jsdom',
51+
},
52+
},
4853
]
4954
}
5055
})

0 commit comments

Comments
 (0)