Code Monkey home page Code Monkey logo

jest-run-it's Introduction

Jest Run It - Jest Test Runner for VS Code

Run and debug your Jest tests with ease from VS Code

A VS Code extension that will help you run and debug Jest tests from your editor. You no longer have to run your entire test suite for that one test you changed ๐ŸŽ‰

Getting Started

  1. Install the extension.
  2. Open the test file.
  3. Run tests.

Troubleshooting

  1. You don't see the run/link buttons: If you are not seeing the buttons for running the tests, it could be because the plugin did not recognize the file as a test file. You need to update the test match patterns so that it will be recognized as a test file. See the config options section to see more details.

  2. Your Jest is installed differently: There is a config option to specify your Jest path. See the config options.

  3. Jest does not match your test when you run it from the CodeLens Jest on Windows has different treatment for single and double quotes in command-line arguments.

    The following command may NOT work on Windows because test name is wrapped with apostrophee: node_modules\.bin\jest 'c:/samples/my service/test/get-data.spec.js'

    No tests found, exiting with code 1
    Run with `--passWithNoTests` to exit with code 0
    In C:\samples\my service
    53 files checked.
    testMatch: **/__tests__/**/*.[jt]s?(x), **/?(*.)+(spec|test).[tj]s?(x) - 1 match
    testPathIgnorePatterns: \\node_modules\\ - 35 matches
    testRegex:  - 0 matches
    Pattern: 'c:\\samples\\my service\\test\\get-data.spec.js' - 0 matches

    Wrapping file name with quotation marks solves the problem: node_modules\.bin\jest "c:/samples/my service/test/get-data.spec.js"

    There is a config option to control quotation marks to use in command-line arguments. See the config options.

Config Options

Option Description
Jest Config Path Jest config file path relative to the current workspace (e.g: ./jest.config.js)
Jest Path Absolute path to the Jest binary (default: node_modules/.bin/jest)
Run Test Label Label for the run test action
Debug Test Label Label for the debug test action
Update Snapshosts Label Label for update snapshots action
Custom Snapshot Matchers Custom snapshot matchers
Test Match Patterns Glob patterns to match test files (default: ['/*.{test,spec}.{js,jsx,ts,tsx}', '/tests/*.{js,jsx,ts,tsx}'])
Argument Quotes To Use Quotation marks to use in command-line arguments: 'auto', 'single', 'double' or 'none'
Jest CLI Options Specify CLI options for the Jest command (e.g --coverage)
Environment variables Environment variables separated by a space (e.g NODE_ENV=prod TEST_SUITE=all)

Features

1. Run/debug individual tests from any test file:

2. Test explorer view:

3. Editor title actions to run/debug tests:

jest-run-it's People

Contributors

nithinpeter avatar npeterat avatar ssteinvil-forescout avatar tinganho avatar micaelmbagira avatar th0was14 avatar

Stargazers

Roman 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.