Troubleshooting & FAQ¶
First step: the Jest Runner output channel¶
Set "jestrunner.enableDebugLogs": true, open View → Output and choose Jest Runner from the dropdown.
It logs, for every file it looks at, which config was found, which patterns were applied and whether the file
matched, and for every run the exact command and working directory. Most questions below are answered by
reading that log.
No CodeLens, no tests in the Test Explorer¶
The file was not classified as a test file. The check has three parts, and all must pass:
- The file matches the patterns. Either the
testMatch/testRegexof the Jest config, theincludeof the Vitest config, thetestMatch/testDirof Playwright, theincludeof Rstest or Deno, or, when none is configured,jestrunner.defaultTestPatterns. Exclusions (testPathIgnorePatterns,exclude,testIgnore,roots) are applied too. - A framework is found. By import, by a config file above the file, by a dependency in
package.jsonor by an installed binary. A plain folder without any of these yields nothing. - No other framework claims the file. A file inside the
testDirof a Playwright config, or matching a CypressspecPattern, is left to that tool.
Typical fixes:
- The config is not understood by the static parser (see below): set
jestrunner.disableFrameworkConfigandjestrunner.defaultTestPatterns. - The tests live in a sub project: set
jestrunner.projectPath. - The framework is installed globally only: install it in the project, or set the
*Command.
The wrong framework runs¶
- Imports win over configs. A file importing
bun:testis a Bun test even inside a Jest project. - A
vite.config.tswithout atestsection does not make a directory a Vitest project; avitest.config.tsor atestsection does. - With both a Jest and a Vitest config in one directory, the file patterns decide; if both match (or neither has
explicit patterns) Jest wins. Give one of them explicit
testMatch/includepatterns, or setjestrunner.configPath/jestrunner.vitestConfigPathas glob mappings. package.jsondependencies are checked top-down from the test file's directory; the first directory with any supported framework wins, in the order Vitest, Jest, Bun, Deno, Playwright, Rstest.
Limits of the config parser¶
Config files are parsed as an AST and never executed. Supported:
- object and array literals, strings, numbers, booleans,
null,undefined const/let/vardeclared at the top level of the same file, including destructuring, spread, template literals and+concatenation of resolvable values;ascasts and!assertions are ignoredrequire('./relative/file')of another local CommonJS file (itsmodule.exportsis read the same way)module.exports = ...,exports.x = ...,export default ...,export const ...- any wrapper call whose argument is the config, such as
defineConfig({...}),mergeConfig(base, {...})ordefineProject({...}), and functions returning an object (() => ({ ... }),defineConfig(() => ({...}))) __dirnameforrootDir/root- JSON and JSONC (
deno.jsonc)
Not supported: ES import of other files or packages (import { nxPreset } from '@nx/jest/preset'), function
calls with logic, conditions, process.env, regular expression literals. The parser then returns what it could resolve, usually without
patterns, and the default patterns apply. See Config File Parsing.
Tests run, but the Test Explorer shows no result¶
Results come from a reporter Jest Runner injects into the run (Jest, Vitest, Node.js), from JUnit XML (Rstest,
Bun, Deno) or from JSON output (Playwright). If a custom reporter in your config suppresses the default output,
or jestrunner.*RunOptions adds --silent, the output may be empty: the log then says No output from test
runner. Results that cannot be matched to a test leave the test as skipped; a failing suite without any
results (import error) reports the error on all its tests.
"Test output exceeded maximum buffer size"¶
A Test Explorer run produced more than jestrunner.maxBufferSize MB of output and was stopped. Raise the
limit, or reduce the output (--silent, fewer console.log).
Debugging does not stop at breakpoints¶
- Jest: make sure
--runInBandis in effect (it is added by default) and source maps are produced by your transformer. With a customruntimeExecutableinjestrunner.debugOptionsyou are on your own: Jest Runner only appends the file and name filter. - Vitest: the program is
vitest.mjs; breakpoints needsourcemapin the Vite config for transformed files. - Bun: install the Bun extension; the debug type is
bun. - Deno: the session attaches on port 9229; another process on that port blocks it.
- nvm and friends: the debugger does not run your shell profile. Set
runtimeExecutableto the Node binary.
Coverage shows nothing¶
- Jest / Vitest / Rstest: the extension reads
coverage-final.json. It is written by thejsonreporter, which the Test Explorer adds; acoverageReporters/coverage.reportersetting in the config that dropsjsonis overridden by the CLI flag. CheckcoverageDirectory/reportsDirectory: the log prints the path it tried. - Vitest additionally needs
@vitest/coverage-v8or@vitest/coverage-istanbulinstalled. - Node.js / Bun / Deno:
lcov.infois searched from the test file's directory up to the workspace folder, in the directory itself and incoverage/. - Test files and
node_modulesare deliberately not shown.
Windows specifics¶
- Test names with
$, backticks,%,|or quotes are quoted for the shell of the integrated terminal. If you change the default terminal profile, new terminals get the new quoting. npx,yarnandpnpmare.cmdfiles; Test Explorer runs start them throughcmd.exeautomatically.- Command lines longer than about 8,000 characters (cmd.exe) or 30,000 characters (direct spawn) are shortened: Jest and Vitest drop the explicit file list and run the project with the name filter; other frameworks are split into two runs.
- Paths are compared case-insensitively when matching results, and symlinked workspaces are resolved.
FAQ¶
Can I keep using the Jest extension by Orta or the Vitest extension next to Jest Runner?
Yes. Jest Runner does not watch or run anything in the background. Disable jestrunner.enableCodeLens or
jestrunner.enableTestExplorer if two sets of buttons bother you.
Why are the commands called "Run Jest" for Vitest and the others? History: the extension started as a Jest runner. The command IDs are kept so existing keybindings keep working. Each command runs the framework of the current file.
Does the extension execute my config files?
No. It parses them statically. That is why complex configs may need jestrunner.disableFrameworkConfig.
Does it work with remote development (SSH, WSL, Dev Containers, Codespaces)? Yes. The extension runs where your files are (the remote side), so detection and the spawned processes see the same file system and binaries as your terminal.
How do I run all tests of the project? Right-click the root folder in the explorer and choose Run Jest on Path, or use the run button at the top of the Test Explorer.
Where are the reporter files written?
To <temp>/vscode-jest-runner-reporters/ (the operating system's temp directory), once per session. They are
plain JavaScript and can be inspected there.
Reporting a bug¶
Open an issue with:
- operating system, shell and VS Code version,
- the test framework and the project type (Nx, Next.js, CRA, Vite, ...),
- your
jestrunner.*settings, - the relevant config file (
jest.config.js,vitest.config.ts, ...), - the Jest Runner output with
enableDebugLogson.