Skip to content
| Marketplace
Sign in
Visual Studio Code>Testing>Run Related Jest TestsNew to Visual Studio Code? Get it now.
Run Related Jest Tests

Run Related Jest Tests

Nick Dawe

|
7 installs
| (0) | Free
Runs Jest tests on files related to given JS/TS files
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Run Related Jest Tests

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.

Usage

  1. Open a JS/TS/JSX/TSX file, or select one in the File Explorer.
  2. 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)).
  3. A terminal named Jest opens and runs jest --findRelatedTests against that file.

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

  1. npm install
  2. Press F5 in VS Code to launch the Extension Development Host and try the commands in a new window.
  3. npm run watch runs webpack in watch mode while you work.
  4. 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

MIT

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft