Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Update tsconfig setup instructions in the README #621

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions README.md

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of these changes, we should add "./vitest.setup.ts" next to "./jest-setup.ts", to make it a bit more obvious.

It appears that a few users are missing out the setup step for TypeScript when using a *.setup.ts file. Perhaps we should add a reference to it in other sections and also make the below line bold?

If you're using TypeScript, make sure your setup file is a .ts and not a .js to include the necessary types

If you're using TypeScript, make sure your setup file is a .ts and not a .js to include the necessary types

Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,20 @@ setupFiles: ['./vitest-setup.js']
If you're using TypeScript, make sure your setup file is a `.ts` and not a `.js`
to include the necessary types.

You will also need to include your setup file in your `tsconfig.json` if you
haven't already:
You will also need to include the following in your `tsconfig.json`:

```json
{
// In tsconfig.json
"include": [
...
// ...
"./jest-setup.ts"
],
"compilerOptions": {
// ...
"types": ["@testing-library/jest-dom"]
}
}
```

### With another Jest-compatible `expect`
Expand Down
Loading