Hop to Test
A VS Code extension that allows you to quickly hop between source files and their corresponding test files.

Features
- Hop from source to test: When viewing a source file (e.g.,
SomeComponent.jsx), hop to its test file (e.g., SomeComponent.test.js)
- Hop from test to source: When viewing a test file (e.g.,
useFancyHook.test.js), hop back to the source file (e.g., useFancyHook.js)
- Multiple file patterns: Supports
.test.js, .test.ts, .spec.js, .spec.ts, and more
- Multiple extensions: Works with
.js, .jsx, .ts, .tsx, .mjs, .cjs
Usage
- Open a source file or test file in VS Code
- Press
Ctrl+Shift+T (or Cmd+Shift+T on macOS) to hop to the corresponding test/source file
- Alternatively, use the Command Palette (
Ctrl+Shift+P / Cmd+Shift+P) and search for "Hop to Test/Source"
Supported Patterns
Source Files
Component.jsx → Component.test.js or Component.test.jsx
useHook.ts → useHook.test.ts
MyComponent.js → MyComponent.test.js or MyComponent.spec.js
Test Files
Component.test.js → Component.js or Component.jsx
useHook.test.ts → useHook.ts or useHook.tsx
MyComponent.spec.js → MyComponent.js or MyComponent.jsx
Development
Setup
npm install
Build
npm run compile
Watch Mode
npm run watch
Testing
- Press
F5 to open a new Extension Development Host window
- Open a JavaScript/TypeScript file or test file
- Press
Ctrl+Shift+T (or Cmd+Shift+T) to test the extension
License
MIT
| |