Jest: Notification pops up even when no tests are run

Created on 31 May 2018  路  11Comments  路  Source: facebook/jest

馃悰 Bug Report

Jest notifies me as follows that 100% of 0 tests passed when I save any file in my watched directories, even if there are no tests associated with it. What is the utility of this?

To Reproduce

Steps to reproduce the behavior:

  1. Run jest with --watch --notify
  2. Save a file that is untested
  3. Notification like so shows up and console says No tests found related to files changed since last commit.

screen shot 2018-05-30 at 5 14 50 pm

Expected behavior

Notifications are only shown when tests are run

  • jest 23.1.0
  • node 8.11.2
  • macOS 10.13.4
Enhancement Help Wanted good first issue

Most helpful comment

I think such "empty" notifications may be annoying, especially when fiddling with git a lot. I'm OK with not displaying it whenever there were no tests run.

All 11 comments

PR welcome!

I think a notification might make sense? But it should say "no tests ran" or something.

Code is here: https://github.com/facebook/jest/blob/master/packages/jest-cli/src/reporters/notify_reporter.js

Happy to pick this one up.

What's the proposed format as currently the notifier expects a message and a title?

Awesome! Title maybe "No tests were run", and an empty message?

My thinking was that there should be no notification unless some tests are run. What鈥檚 the point of a notification that says nothing ran?

Yeah this makes sense to me as well as the expected behaviour. Could simply check result of the test run and exit early from the notifier logic if numTotalTests === 0?

@thymikee @rickhanlonii thoughts?

I think such "empty" notifications may be annoying, especially when fiddling with git a lot. I'm OK with not displaying it whenever there were no tests run.

Please, add an options to notify in case of faled test only

@SimenB sorry, not noticed (
but...

    notify: true,
    notifyMode: 'failure',

shows notification if test is passed successfully

 jest: "^23.1.0",
 OS: Windos 7

Closed via #6495

Was this page helpful?
0 / 5 - 0 ratings