Right-click a JavaScript/TypeScript file and run its related Jest tests, without leaving the editor or typing a command.
Features
Explorer & editor context menu — right-click any .js, .jsx, .ts, or .tsx file (in the File Explorer or in an open editor tab) and select Run Related Jest Tests.
Source Control context menu — right-click a changed file in the Source Control (SCM) sidebar and select Run Related Jest Tests (SCM) to test just what you've touched.
Automatic Jest resolution — walks up from the file's own directory to find the nearest node_modules/jest, then checks for a hoisted install above the workspace root (monorepos), and finally falls back to npx jest (covers pnpm's symlinked store and global installs) if nothing local is found.
Usage
Open a JS/TS/JSX/TSX file, or select one in the File Explorer.
Right-click and choose Run Related Jest Tests (or, for a pending change, right-click the file in the Source Control sidebar and choose Run Related Jest Tests (SCM)).
A terminal named Jest opens and runs jest --findRelatedTests against that file.
Requirements
Jest must be installed somewhere resolvable from the file being tested (locally, hoisted in a monorepo, or available via npx/global install).
Node.js must be available on PATH for the npx fallback case.
Known Limitations
Test results are printed to a terminal, not surfaced through VS Code's Test Explorer or any programmatic UI.
Relies on Jest's built-in --findRelatedTests resolution, so it inherits whatever that flag does (and doesn't) match in a given project's Jest config.
Release Notes
See CHANGELOG.md for the full history. Highlights:
Automatic discovery of the nearest Jest install, including monorepo/hoisted layouts and an npx fallback.
Support for JS, JSX, TS, and TSX files.
A Source Control context-menu command for running related tests on changed files.
Contributing / Development
npm install
Press F5 in VS Code to launch the Extension Development Host and try the commands in a new window.
npm run watch runs webpack in watch mode while you work.
npm run lint and npm test before submitting changes (npm test compiles the extension and its tests, lints, then runs the Mocha suite via @vscode/test-electron).
To produce a .vsix package locally:
npm install -g @vscode/vsce
npm install
npm run compile
npm run package
npm run vscode:package