Skip to content

Commit

Permalink
Vite template testing library types (#1397)
Browse files Browse the repository at this point in the history
* Add "@testing-library/jest-dom" to types in tsconfig.json as WebStorm doesn't see matchers extension.
Fix "queryByRole" unnecessary await.

* Add "@testing-library/jest-dom" to types in tsconfig.json as Typescript(WebStorm) doesn't see matchers extension.
Fix "queryByRole" unnecessary await.
  • Loading branch information
vladrose authored Mar 18, 2024
1 parent 3095888 commit 050f4a2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion examples/with-vitest/src/components/Counter.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Counter from "./Counter";
describe("<Counter />", () => {
it("increments value", async () => {
const { queryByRole } = render(() => <Counter />);
const button = (await queryByRole("button")) as HTMLButtonElement;
const button = queryByRole("button") as HTMLButtonElement;
expect(button).toBeInTheDocument();
expect(button).toHaveTextContent(/Clicks: 0/);
await userEvent.click(button);
Expand Down
2 changes: 1 addition & 1 deletion examples/with-vitest/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"allowJs": true,
"strict": true,
"noEmit": true,
"types": ["vinxi/client", "vite/client", "vitest/globals"],
"types": ["vinxi/client", "vite/client", "vitest/globals", "@testing-library/jest-dom"],
"isolatedModules": true,
"paths": {
"~/*": ["./src/*"]
Expand Down

0 comments on commit 050f4a2

Please sign in to comment.