Jest: Feature Request: Hide watch usage

Created on 3 Nov 2016  ·  7Comments  ·  Source: facebook/jest

I used tmux in my workflow to run my editor on top and jest on the bottom.

| editor |
|--------|
|  jest  |
----------

Right now, jest in watch mode takes up a lot of screen real estate that I would like to regain.

Do you want to request a feature or report a bug?
Feature

What is the current behavior?

Watch Usage
 › Press a to run all tests.
 › Press o to only run tests related to changed files.
 › Press p to filter by a filename regex pattern.
 › Press q to quit watch mode.
 › Press Enter to trigger a test run.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal repository on GitHub that we can npm install and npm test.
jest --watch

What is the expected behavior?
Watch usage should only be displayed after the initial run. On subsequent runs, it should be hidden. Alternatively, an env variable to disable the usage display.

Run Jest again with --debug and provide the full configuration it prints. Please mention your node and npm version and operating system.

❯ ./node_modules/.bin/jest --debug
jest version = 16.0.2
test framework = jasmine2
config = {
  "scriptPreprocessor": "/Users/mike/Development/go/src/github.com/BriteContent/brite-ui/node_modules/babel-jest",
  "testPathDirs": [
    "/Users/mike/Development/go/src/github.com/BriteContent/brite-ui/app/assets/javascripts/components"
  ],
  "rootDir": "/Users/mike/Development/go/src/github.com/BriteContent/brite-ui",
  "name": "-Users-mike-Development-go-src-github.com-BriteContent-brite-ui",
  "setupFiles": [],
  "testRunner": "/Users/mike/Development/go/src/github.com/BriteContent/brite-ui/node_modules/jest-jasmine2/build/index.js",
  "usesBabelJest": true,
  "automock": false,
  "bail": false,
  "browser": false,
  "cacheDirectory": "/var/folders/ty/n96nv4jj6vn7thgkjskkrfpc0000gn/T/jest",
  "clearMocks": false,
  "coveragePathIgnorePatterns": [
    "/node_modules/"
  ],
  "coverageReporters": [
    "json",
    "text",
    "lcov",
    "clover"
  ],
  "globals": {},
  "haste": {
    "providesModuleNodeModules": []
  },
  "mocksPattern": "__mocks__",
  "moduleDirectories": [
    "node_modules"
  ],
  "moduleFileExtensions": [
    "js",
    "json",
    "jsx",
    "node"
  ],
  "moduleNameMapper": {},
  "modulePathIgnorePatterns": [],
  "noStackTrace": false,
  "notify": false,
  "preset": null,
  "preprocessorIgnorePatterns": [
    "/node_modules/"
  ],
  "resetModules": false,
  "testEnvironment": "jest-environment-jsdom",
  "testPathIgnorePatterns": [
    "/node_modules/"
  ],
  "testRegex": "(/__tests__/.*|\\.(test|spec))\\.jsx?$",
  "testURL": "about:blank",
  "timers": "real",
  "useStderr": false,
  "verbose": null,
  "watch": false,
  "cache": true,
  "watchman": true,
  "testcheckOptions": {
    "times": 100,
    "maxSize": 200
  }
}
❯ node --version && npm --version
v6.9.0
3.10.8



md5-d35f8939975b75426e712e977337f824



MacOS Siera 10.12.1 (16B2555)

Most helpful comment

Maybe we could add an option in config and CLI, some thing like hideWatchUsage? This also bugged me when I try to use watch in my editor's terminal, so maybe lets reopen?
Especially that it should be easier to implement since watch extraction.
cc: @rogeliog @cpojer

All 7 comments

We are gonna keep this for now. If you have suggestions on how to not make this confusing for users, I'm happy to review and accept a pull request but it isn't something we'll do from our end.

Sad to see this is still how it's working. People use jest output to constantly monitor test results in IDEs like Atom. It should not show garbage.

Maybe we could add an option in config and CLI, some thing like hideWatchUsage? This also bugged me when I try to use watch in my editor's terminal, so maybe lets reopen?
Especially that it should be easier to implement since watch extraction.
cc: @rogeliog @cpojer

There is already an ENV variable. See https://github.com/facebook/jest/pull/2125

Whoa, I missed that!

ok great thanks guys!

I would still suggest to go for a proper config property. It is often very fiddly to configure things with environment variables, as it's platform specific. I've been trying to configure this on vscode, to no avail, the jest plugin isn't picking this up. Thanks.

Was this page helpful?
0 / 5 - 0 ratings