Coder Social home page Coder Social logo

pustelto / vscode-jest-runner Goto Github PK

View Code? Open in Web Editor NEW

This project forked from firsttris/vscode-jest-runner

0.0 1.0 0.0 992 KB

Simple way to run or debug a single (or multiple) tests from context menu

License: MIT License

TypeScript 88.27% JavaScript 11.73%

vscode-jest-runner's Introduction

vscode-jest-runner

Visual Studio Code Marketplace

Go to Marketplace

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
  • run previous test from command palette (strg+shift+p)
  • supports yarn & vscode workspaces (monorepo)
  • works with CRA & react-scripts!

Extension Example

Usage with Create-React-App or React-Scripts

add this to settings.json

"jestrunner.jestCommand": "npm run test --"

Requirements

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

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 configure 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)

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"
},

Want to start contributing features?

Some open topics get you started

Notes

  • By default Jest finds its config from the "jest" attribute in your package.json or if you export an object module.export = {} in a jest.config.js file in your project root directory.
    Read More: Configuring Jest Docs

  • If Breakspoints are not working properly, try adding this to vscode config:

"jestrunner.debugOptions": {
    "args": ["--no-cache"],
    "sourcemaps": "inline",
    "disableOptimisticBPs": true,
}

vscode-jest-runner's People

Contributors

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

Watchers

 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.