Code Monkey home page Code Monkey logo

vscode-jest-runner's Introduction

vscode-jest-runner

The Aim

Simple way to run or debug a single or multiple Jest-Tests from context menu.
As it is possible in IntelliJ / Webstorm

Features

Run your Jest Tests from context-menu

  • right click your test and select Run Jest from context menu
  • to run a test in debug mode use Debug Jest

Extension Example

Requirements

  • Have a valid Jest config
  • Have Jest installed globally or as project dependency

Extension Settings

By default Jest finds config from package.json or if you module.export = {} in a jest.config.js file.

But if you need to define a external config file use the following config options:

Command Description
jestrunner.configPath Define an external jest-config path to jest (from ${workFolder} e.g. jest-config.json)
jestrunner.jestPath Define an absolute path to jest (e.g. /usr/lib/node_modules/jest/bin/jest.js)
jestrunner.runOptions Add or overwrite VScode run options in settings.json (e.g. "jestrunner.runOptions": { "args": ["--no-cache"] })
jestrunner.jestCommand Define an alternative Jest command (e.g. for Create React App and similar abstractions)

Shortcuts

click File -> Preferences -> Keyboard Shortcuts -> "{}" (top right) the json config file will open add this:

{
  "key": "alt+1",
  "command": "extension.runJest"
},
{
  "key": "alt+2",
  "command": "extension.debugJest"
},

Known Issues

  • Breakspoints not working properly, add this to vscode config:
"jestrunner.runOptions": {
    "args": ["--no-cache"],
    "sourcemaps": "inline",
    "disableOptimisticBPs": true,
}
  • Possibility to show the additional context menu items only while in a test file e.g. test.(js|ts). Currently its shown, no matter which file.

vscode-jest-runner's People

Contributors

firsttris avatar alexsotocx avatar domoritz avatar pbug90 avatar morrislaptop avatar juhq avatar adi518 avatar calebfrieze avatar krizzdewizz avatar dj0nes avatar jefstat avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.