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: clean up readme file #265

Merged
merged 2 commits into from
Feb 25, 2024
Merged
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
69 changes: 18 additions & 51 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,74 +1,41 @@
<p align="center">
<br />
<a title="Learn more about Vitest for VSCode" href="https://github.com/vitest-dev/vscode"><img src="./img/cover.png" alt="Vitest for VSCode Logo" width="50%" /></a>

<a title="Learn more about Vitest extension for Visual Studio Code" href="https://github.com/vitest-dev/vscode"><img src="./img/cover.png" alt="Vitest extension for Visual Studio Code logo" width="50%" /></a>
</p>

<h2 align="center">
<b>Vitest for VSCode</b>
</h2>

<br />
<h1 align="center">Vitest extension for Visual Studio Code. Available on <a href="https://marketplace.visualstudio.com/items?itemName=vitest.explorer">Visual Studio Marketplace</a>.</h1>

![](https://i.ibb.co/bJCbCf2/202203292020.gif)

> This extension is powered by
> [vscode testing api](https://code.visualstudio.com/api/extension-guides/testing).
## Features

# Features

- Run/debug vitest tests in vscode.
- **Run**, **debug**, and **watch** Vitest tests in Visual Studio Code.
- NX support (see the [NX sample](./samples/monorepo-nx/)).
- Watch mode is supported 🎊. Test reruns are blazing fast.
- A `@open` tag can be used when filtering tests, to only show the tests open in the editor.

![Watch Mode](https://i.ibb.co/YRhJj9f/Screen-Recording-2022-05-21-at-20-09-20.gif)

# Requirements
## Requirements

- Require VSCode's version >= July 2021 (version 1.59).
- Require Vitest's version >= v0.12.0
- Visual Studio Code version >= July 2021 (version 1.59).
- Vitest version >= v0.12.0

# Config
## Configuration

- `vitest.enable`: This plugin will try to detect whether the current project is
set up with Vitest to activate itself. If detection fails, you can enable the plugin manually.
- `vitest.watchOnStartup`: Whether to activate Watch mode per default when the extension starts.
- `vitest.nodeEnv`: The env passed to runner process in addition to
- `vitest.enable`: Extension will automatically detect if the current project is using Vitest. If detection fails, extension can be manually enabled via this option.
- `vitest.watchOnStartup`: Whether to activate Watch mode by default when the extension starts.
- `vitest.nodeEnv`: Environment passed to the runner process in addition to
`process.env`
- `vitest.commandLine`: The command line to start vitest tests. **It should have with the ability
- `vitest.commandLine`: Command to execute Vitest tests. **It should have the ability
to append extra arguments**. For example
`npx vitest` or `yarn test --`.(This is a workspace setting. Do not change it in
the user setting directly, which will affect all the projects you open)
- `vitest.debugExclude`: Automatically skip files covered by these glob patterns. Default:
`npx vitest` or `yarn test --`. This is a workspace setting. Do not change it in
the user settings, since it will affect all the projects you open)
- `vitest.debugExclude`: Excludes files matching specified glob patterns from debugging. Default:
`[\"<node_internals>/**\", \"**/node_modules/**\"]`

# Screenshots

**Filter tests by status**

<img src="https://i.ibb.co/K903GYL/Screen-Recording-2022-03-29-at-20-41-54.gif"/>

**Debug**
## FAQs (Frequently Asked Questions)

<img src="https://i.ibb.co/SXtF6Yp/Screen-Recording-2022-03-29-at-20-49-54.gif"/>

**Inspect console output**

![](https://i.ibb.co/gMZWXZQ/Screen-Recording-2022-03-29-at-20-59-31.gif)

# FAQ

#### **How can I use it in monorepo?**
### How can I use it in monorepo?

See <https://vitest.dev/guide/workspace.html> for monorepo support.

#### **How can I use this extension when tests are under a sub directory?**
### How can I use this extension when tests are under a sub directory?

You can use VS Code command `add folder to workspace` to add the sub directory. The extension should work fine.

#### **`test.each` is not working**

Dynamic test name is not supported yet. This extension currently relies on the babel parser to calculate the positions of tests statically.

Related issue: https://github.com/vitest-dev/vscode/issues/133
Loading