vitestの設定
$ yarn add -D vitest
code:vite.config.ts
+ /// /// <reference types="vitest" />
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
export default defineConfig({
+ test: {
+ globals: true,
+ environment: "jsdom",
+ },
});
$ yarn vitest run
viteを使っていいない場合
code:vitest.confg.ts
import { configDefaults, defineConfig } from 'vitest/config'
export default defineConfig({
test: {
},
})
$ yarn vitest run --config ./path/to/vitest.config.ts