Skip to content

rogeliog/jest-watch-mock-stdin

Repository files navigation

Build Status npm version

jest-watch-mock-stdin

Mock stdin for Jest

Usage

Install

Install jest-watch-mock-stdin

yarn add --dev jest jest-watch-mock-stdin

# or with NPM

npm install --save-dev jest jest-watch-mock-stdin

Add it to your Jest config

In your jestConfig

watchPlugins: [
    ["jest-watch-mock-stdin", {
        input: [
            { keys: ['p', 'b', 'a', 'r', '\n'] },
            { keys: ['q'] },
        ]
    ]
],

The keys inside the keys array will be type immediately one after the other. It will wait for a test run to be completed before moving to the next keys array

Fox example, the config above will:

  1. Press P to filter by filename
  2. Enter 'bar' and press enter in the "filter by filename prompts"
  3. Wait for the test run to end.
  4. Press Q to quit Jest.

About

Jest watch plugin for mocking stdin

Resources

License

Stars

Watchers

Forks

Packages

No packages published