Skip to content

Commit bb8341a

Browse files
committed
test: migrate to vitest
1 parent b643635 commit bb8341a

File tree

2 files changed

+22
-10
lines changed

2 files changed

+22
-10
lines changed

test/setup.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { expect, afterEach } from "vitest";
2+
import { cleanup } from "@testing-library/react";
3+
import * as matchers from "@testing-library/jest-dom/matchers";
4+
5+
expect.extend(matchers);
6+
7+
afterEach(() => {
8+
cleanup();
9+
});

vitest.config.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
import { defineConfig } from "vitest/config";
2-
import babel from "@rollup/plugin-babel";
3-
4-
const extensions = [".ts", ".tsx", ".js"];
5-
const babelPlugin = babel({
6-
babelHelpers: "bundled",
7-
sourceMaps: true,
8-
extensions,
9-
exclude: /node_modules.*/,
10-
});
2+
import react from "@vitejs/plugin-react";
113

4+
// https://vitejs.dev/config/
125
export default defineConfig({
13-
plugins: [babelPlugin],
6+
plugins: [
7+
react({
8+
babel: {
9+
exclude: /node_modules.*/,
10+
},
11+
}),
12+
],
13+
test: {
14+
environment: "jsdom",
15+
setupFiles: ["./test/setup.ts"],
16+
},
1417
});

0 commit comments

Comments
 (0)