VSX CompatibleOXP Native: Planned

// Description

A Vite-native testing framework. It's fast!

// Readme

Open VSX

##Features

  • Run, debug, and watch Vitest tests in Visual Studio Code.
  • Coverage support
  • Inline console.log display: Console logs appear inline in the editor next to the code that produced them
  • Imports duration: Displays the execution time for each import during continuous test runs.

##Requirements

  • Visual Studio Code version >= 1.77.0
  • Vitest version >= v1.4.0
  • Node.js version >= 18.0.0 (follows Vitest)
  • Coverage requires Visual Studio Code >= 1.88.0

##Usage

You can manage tests both from the Testing view and directly within your test files.

Vitest uses vscode's TestController API to provide a unified testing experience. You can read the official guide on how to run tests in the VSCode Documentation.

###In the Testing View

Testing view

You can access the extension from the Testing view in the Visual Studio Code sidebar.

The toolbar at the top provides various commands to manage test execution:

  • Refresh Tests: To reload your test suite, reflecting any new changes.
  • Run All Tests: To start testing all cases that are currently visible.
  • Debug Tests: To begin a debugging session for the tests.
  • Run Tests with Coverage: To start testing all cases that are currently visible, while also collecting code coverage information.
  • Continuous Run/Stop Continuous Run: To toggle the watch mode for running tests on file changes.
  • Show Output: To display detailed logs from test executions.
  • Miscellaneous Settings: To customize the Testing view, such as sorting and grouping tests.

💡 Hovering, or right clicking a folder, test file, test suite, or a test will reveal more actions.

The filter bar allows you to narrow down the tests displayed, focusing on specific tests by name, exclusion patterns, or tags.

Icons next to each test indicate their status—passed (checkmark), failed (cross), skipped (arrow), queued (yellow icon), or not executed (dot).

###In the Test File

Vitest test file

When viewing a test file, you'll notice test icons in the gutter next to each test case:

  • Run a Single Test: Click the test icon next to a test case to run that specific test.
  • More Options: Right-click the test icon to open a context menu with additional options:
    • Run Test: Execute the selected test case.
    • Debug Test: Start a debugging session for the selected test case.
    • Run with coverage: Execute the selected test case while also collecting code coverage information.
    • Reveal in Test Explorer: Locate and highlight the test in the centralized Testing view.
    • Breakpoint Settings: Set breakpoints to pause execution during debugging. You can add a standard breakpoint, a conditional breakpoint, a logpoint, or a triggered breakpoint.

##Configuration

You can identify if your config is loaded by the extension with process.env.VITEST_VSCODE and change the configuration accordingly.

###Workspace Configurations

These options are resolved relative to the workspace file if there is one. If you have a single folder open in Visual Studio Code, paths will be resolved relative to that folder. If there are multiple folders, but there is no workspace file, then paths are resolved as is (so they should be absolute) - this can happen if you change your user config to have multiple folders.

KeyDescriptionTypeDefault
vitest.rootConfigThe path to your root config file. If you have several Vitest configs, consider using a Vitest workspace.string
vitest.workspaceConfigThe path to the Vitest workspace config file. You can only have a single workspace config per VSCode workspace.string
vitest.ignoreWorkspaceIgnores the workspace resolution step. The extension will only look for vitest.config files.boolean
vitest.configSearchPatternIncludeGlob pattern used when looking for config files. Applied to config files, not test files inside configs.string**/*{vite,vitest}*.config*.{ts,js,mjs,cjs,cts,mts}
vitest.configSearchPatternExcludeGlob pattern ignored when looking for config files. Applied to config files, not test files inside configs. If the extension cannot find Vitest, please open an issue.string{**/node_modules/**, **/vendor/**, **/.*/**, *.d.ts}
vitest.runtimeThe default runtime to run tests in. Supported: auto, node, deno. If auto, the extension looks for a deno.enabled config flag or a deno.json file in the root folder.stringauto
vitest.shellTypeThe method the extension uses to spawn a Vitest process. Useful if you use a custom shell script to set up the environment. When using terminal, a websocket connection is established."child_process" | "terminal"child_process
vitest.nodeExecutableThe path to the Node.js executable. If not set, tries to find it via PATH or which. Only applies when vitest.shellType is child_process.string
vitest.nodeExecArgsArguments to pass to the Node.js executable. Only applies when vitest.shellType is child_process.string[]
vitest.terminalShellPathThe path to the shell executable. Only applies when vitest.shellType is terminal.string
vitest.terminalShellArgsArguments to pass to the shell executable. Only applies when vitest.shellType is terminal.string[]
vitest.debuggerPortPort the debugger will be attached to. Uses 9229 or finds a free port if unavailable.number9229
vitest.debuggerAddressTCP/IP address of the process to be debugged.stringlocalhost
vitest.cliArgumentsAdditional arguments to pass to the Vitest CLI. Note: watch, reporter, api, and ui are ignored. Example: --mode=stagingstring
vitest.showImportsDurationShow how long it took to import and transform modules. Hovering provides more diagnostics.boolean
vitest.watchOnStartupKeep Vitest running in the background on startup, rerunning tests when files change. Same as enabling continuous run.booleanfalse

💡 The vitest.nodeExecutable and vitest.nodeExecArgs settings are used as execPath and execArgv when spawning a new child_process, and as runtimeExecutable and runtimeArgs when debugging a test. The vitest.terminalShellPath and vitest.terminalShellArgs settings are used as shellPath and shellArgs when creating a new terminal

###Other Options

KeyDescriptionTypeDefault
vitest.filesWatcherIncludeGlob pattern for the watcher that triggers a test rerun or collects changes.string**/*
vitest.vitestPackagePathPath to a package.json of a Vitest executable (usually in node_modules) if the extension cannot find it. Used to resolve Vitest API paths. Last resort fix.string
vitest.nodeEnvEnvironment passed to the runner process in addition to process.env.object
vitest.debugNodeEnvEnvironment passed to the runner process in addition to process.env and vitest.nodeEnv when debugging tests.object
vitest.debugExcludeGlob patterns for files to exclude from debugging.string[]["<node_internals>/**", "vitest/dist/**"]
vitest.debugOutFilesIf source maps are enabled, glob patterns specifying the generated JavaScript files. Patterns starting with ! exclude files. If not set, generated code is expected alongside its source.string[]
vitest.logLevelHow verbose the logger is in the "Output" channel.stringinfo
vitest.applyDiagnosticShow a squiggly line where the error was thrown. Also enables the error count in the File Tab.booleantrue
vitest.showInlineConsoleLogShow console.log messages inline in the editor next to the code that produced them. Logs still appear in test output when disabled.booleantrue
vitest.forceCancelTimeoutMilliseconds to wait for tests to stop gracefully after clicking "Stop" before force-killing Vitest. Consider using the signal API in tests instead.number1000

###Commands

You can reveal the current test file in the test explorer view by selecting the "Reveal in Test Explorer" option (the last option on the screenshot) in the file context:

Reveal test in explorer

You can also type the same command in the quick picker while the file is open.

Reveal test in explorer

###Run Related Tests

You can run all tests that import the current file by using the "Run Related Tests" command. Its triggers are visible in the same places as "Reveal in Test Explorer".

###Import Breakdown

If you use Vitest 4.1 or higher, during continuous runs the extension will show how long it took to load the module on the same line where the import is defined. This number includes transform time and evaluation time, including static imports.

If you hover over it, you can get a more detailed diagnostic.

Import breakdown example

You can disable this feature by turning off vitest.showImportsDuration.

##FAQs (Frequently Asked Questions)

###How can I use it in monorepo?

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

###How to rerun tests when file is changed?

By default, the extension doens't rerun tests when files change.

Click on the "eye" icon next to the test, file or a directory to enable "continuous run" for a related item. Whenever that test, file or any file in the directory changes, Vitest will rerun that test. Note that Vitest will also rerun tests if an imported module of the file is changed.

Turn on continuous run button for a test

To enabled continuous run globally, click on the "eye" icon in the "Test Explorer" row.

Start continuous run button

###How to hide Test Results view when running tests

You can change the behaviour of testing view by modifying testing.automaticallyOpenTestResults option:

  • neverOpen will never open the testing view
  • openOnTestStart (default) opens the test results view when test starts running
  • openOnTestFailure opens the test results view if at least one of test fails
  • openExplorerOnTestStart will open the test tree view when tests starts

This is a vscode's built-in option and will control every plugin.

###The "Stop" button doesn't stop the test fast enough

The stop button stops the test gracefuly in case your test needs to release resources, so Vitest always awaits until the current test is finished. Since Vitest 3.2, you can use a signal to stop any pending promises (like a fetch or db connection) when the test is interrupted:

test('fetch test', async ({ signal }) => {
  // passing down a signal to fetch will make it so the fetch
  // is rejected when the signal is aborted
  await fetch('some-log-or-stuck-call', { signal })
})

Since 1.44.1, Vitest extension will forcefully stop any Vitest process after 1s without waiting for a gracefull exit which may leave hanging processes in the background. Consider using a signal API or raising the vitest.forceCancelTimeout option.

###I am using vitest.shellType: terminal, but I don't see the terminal

The terminal is hidden by default because the content is replicated in the "Test Results" window. However, it might be useful to debug issues with the extension or Vitest itself - to open the terminal in the "Terminals" view you can use the "Vitest: Show Shell Terminal" command.

// Install

Open this extension directly in your IDE — no CLI, no extra tools.

Extension ID
vitest.explorer

If your IDE doesn't open automatically, copy the ID above and paste it into the Extensions view (⌘P ext install <id>).

// Source signals

Publisher
Verified ✓
Rating
5.0 (1)
Downloads
591.8k
Published
2026-05-05
License
MIT
Source
repo
Homepage
link

Live from open-vsx.org. Refreshed hourly.

// Are you the author?

This listing is mirrored from Open VSX. Claim it to ship a native OXP build, customise the page, and respond to reviews.

Claim this listing

// Package Info

Version
1.50.3
Owner
@vsx-vitest
Downloads
551.8k
Stars
0