Skip to content

Commit 41a8111

Browse files
committed
updated vitest guide
1 parent 4173477 commit 41a8111

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

  • content/guides/how-to-guides/testing-in-solid

content/guides/how-to-guides/testing-in-solid/vitest.mdx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@ yarn add -D vitest jsdom @testing-library/jest-dom @solidjs/testing-library
3030
Now that we've installed the necessary packages, we'll need to configure vitest to work with Solid. Let's create a `vitest.config.ts` file in the root of our project.
3131

3232
```ts
33-
/// <reference types="vitest" />
34-
/// <reference types="vite/client" />
35-
// 👆 do not forget to add the references above
36-
3733
import { defineConfig } from 'vite';
3834
import solidPlugin from 'vite-plugin-solid';
3935

@@ -48,7 +44,7 @@ export default defineConfig({
4844
test:{
4945
environment: 'jsdom',
5046
globals: true,
51-
transformMode: { web: [/\.[jt]sx?$/] },
47+
testTransformMode: { web: ["/\.[jt]sx?$/"] },
5248
}
5349
});
5450
```
@@ -98,7 +94,7 @@ In Solid we recommend creating a `test` folder to house all your test files in.
9894

9995
```bash
10096
mkdir test
101-
touch test/App.test.ts
97+
touch test/App.test.tsx
10298
```
10399

104100
Now that we've created the test file, let's add some tests.
@@ -145,8 +141,8 @@ Let's create a test file for our `Counter` component:
145141
```ts
146142
// counter.test.tsx
147143
import { Counter } from "../src/counter";
148-
import { cleanup, fireEvent, render, screen, afterEach } from "solid-testing-library";
149-
import { describe, expect, it } from 'vitest';
144+
import { cleanup, fireEvent, render, screen } from "@solidjs/testing-library";
145+
import { describe, expect, it, afterEach } from 'vitest';
150146
import "@testing-library/jest-dom"
151147

152148
describe("Counter", () => {

0 commit comments

Comments
 (0)