• Stars
    star
    265
  • Rank 154,155 (Top 4 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created almost 7 years ago
  • Updated 7 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Simple way to run or debug one or more tests from context menu, codelens or command plalette

vscode-jest-runner

Looking for collaborators to help me maintain the project. Please contact me at [email protected]

Visual Studio Code Marketplace

VisualStudio Marketplace Open VSX Registry

Comparison with vscode-jest

vscode-jest-runner is focused on running or debugging a specific test or test-suite, while vscode-jest is running your current test-suite everytime you change it.

Features

Simple way to run or debug a specific test As it is possible in IntelliJ / Webstorm

Run & Debug your Jest Tests from

  • Context-Menu
  • CodeLens
  • Command Palette (strg+shift+p)

Supports

  • yarn & vscode workspaces (monorepo)
  • dynamic jest config resolution
  • yarn 2 pnp
  • CRA & and similar abstractions

Extension Example

Usage with CRA or similar abstractions

add the following command to settings:

"jestrunner.jestCommand": "npm run test --",
"jestrunner.debugOptions": {
    "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/react-scripts",
    "runtimeArgs": [
      "test",
      "${fileBasename}",
      "--runInBand",
      "--no-cache",
      "--watchAll=false",
      "--color"
    ]
},

Extension Settings

Jest Runner will work out of the box, with a valid Jest config. If you have a custom setup use the following options to customize Jest Runner:

Command Description
jestrunner.configPath Jest config path (relative to ${workFolder} e.g. jest-config.json)
jestrunner.jestPath Absolute path to jest bin file (e.g. /usr/lib/node_modules/jest/bin/jest.js)
jestrunner.debugOptions Add or overwrite vscode debug configurations (only in debug mode) (e.g. "jestrunner.debugOptions": { "args": ["--no-cache"] })
jestrunner.runOptions Add CLI Options to the Jest Command (e.g. "jestrunner.runOptions": ["--coverage", "--colors"]) https://jestjs.io/docs/en/cli
jestrunner.jestCommand Define an alternative Jest command (e.g. for Create React App and similar abstractions)
jestrunner.disableCodeLens Disable CodeLens feature
jestrunner.codeLensSelector CodeLens will be shown on files matching this pattern (default **/*.{test,spec}.{js,jsx,ts,tsx})
jestrunner.codeLens Choose which CodeLens to enable, default to ["run", "debug"]
jestrunner.enableYarnPnpSupport Enable if you are using Yarn 2 with Plug'n'Play
jestrunner.yarnPnpCommand Command for debugging with Plug'n'Play defaults to yarn-*.*js
jestrunner.projectPath Absolute path to project directory (e.g. /home/me/project/sub-folder), or relative path to workspace root (e.g. ./sub-folder)
jestrunner.changeDirectoryToWorkspaceRoot Changes directory to workspace root before executing the test
jestrunner.preserveEditorFocus Preserve focus on your editor instead of focusing the terminal on test run
jestrunner.runInExternalNativeTerminal run in external terminal (requires: npm install ttab -g)

Shortcuts

Command Pallette -> Preferences: Open Keyboard Shortcuts (JSON) the json config file will open add this:

{
  "key": "alt+1",
  "command": "extension.runJest"
},
{
  "key": "alt+2",
  "command": "extension.debugJest"
},
{
  "key": "alt+3",
  "command": "extension.watchJest"
},
{
  "key": "alt+4",
  "command": "extension.runPrevJest"
}

Want to start contributing features?

Check some open topics get you started

Steps to run Extension in development mode

  • Clone Repo
  • npm install
  • Go to Menu "Run" => "Start Debugging"

Another vscode instance will open with the just compiled extension installed.

More Repositories

1

plugin.video.sendtokodi

πŸ“Ί plays various stream sites on kodi using youtube-dl
Python
125
star
2

mfrc522-rpi

πŸ”‘ Control your MFRC522 RFID Module with your Raspberry-pi and JavaScript
JavaScript
117
star
3

html-webpack-multi-build-plugin

This plugin simplifies the creation of script tags for module and nomodule for a webpack multi build configuration
JavaScript
55
star
4

node-red-contrib-homematic

🏠 Control your Homematic devices using Node-Red
HTML
18
star
5

urbackup-docker

πŸ’Ύ docker container for urbackup-server
Dockerfile
16
star
6

chrome.ipcamviewer

πŸ“Ή Google Chrome IP-Camera Viewer Extension
Vue
15
star
7

repository.sendtokodi

πŸ“¦ SendToKodi Repository
10
star
8

chrome.sendtokodi

πŸ“Ί Send almost every stream from Chrome to Kodi with SendToKodi
JavaScript
9
star
9

homebridge-hyperion-light

πŸ’₯ Homebridge plugin to use Hyperion as HomeKit accessory
JavaScript
7
star
10

babel-node-starter

πŸ“¦ minimal babel nodejs starter-kit
JavaScript
6
star
11

typescript-node-starter

πŸ“¦ minimal typescript nodejs starter-kit
JavaScript
5
star
12

homebridge-wifi370-led-controller

πŸ’‘ Homebridge plugin to use WIFI370 Led-Controller as HomeKit accessory
JavaScript
5
star
13

repository.sendtokodi.python3

5
star
14

gatsby-cv

Curriculum Vitae with gatsbyJS
TypeScript
4
star
15

electron-babel-react-starter

πŸ“¦ minimal electron babel react starter-kit
JavaScript
3
star
16

node-red-contrib-wifi370

πŸ’‘ Integrate your WIFI370 LED-Controller with Node-RED
HTML
3
star
17

homematic-js-rpc

🏠 lightweight Javascript interface for Homematic XML-RPC
JavaScript
2
star
18

chrome.oneclickhistorycleaner

πŸ—‘οΈ One Click History Cleaner with hot reload for Google Chrome
Vue
2
star
19

tvheadend-sundtek-docker

πŸ“Ί docker container for tvheadend with sundtek dvb adapter
Shell
2
star
20

typescript-react-starter

πŸ“¦ minimal typescript react starter
TypeScript
2
star
21

sendtokodi-gatsby

SendToKodi Page
TypeScript
1
star
22

electron-typescript-react-starter

πŸ“¦ minimal electron typescript react starter-kit
JavaScript
1
star
23

homematic-js-api

🏠 lightweight Javascript interface for Homematic Remote Script API (Rega)
JavaScript
1
star
24

react-track

timetracking app
TypeScript
1
star