Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notification pops up even when no tests are run #6363

Closed
swrobel opened this issue May 31, 2018 · 12 comments
Closed

Notification pops up even when no tests are run #6363

swrobel opened this issue May 31, 2018 · 12 comments

Comments

@swrobel
Copy link

swrobel commented May 31, 2018

🐛 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
@SimenB
Copy link
Member

SimenB commented May 31, 2018

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

@taylorwinfield
Copy link
Contributor

Happy to pick this one up.

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

@SimenB
Copy link
Member

SimenB commented Jun 1, 2018

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

@swrobel
Copy link
Author

swrobel commented Jun 1, 2018

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

@taylorwinfield
Copy link
Contributor

taylorwinfield commented Jun 1, 2018

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?

@SimenB
Copy link
Member

SimenB commented Jun 1, 2018

@thymikee @rickhanlonii thoughts?

@thymikee
Copy link
Collaborator

thymikee commented Jun 2, 2018

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.

@budarin
Copy link

budarin commented Jun 9, 2018

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

@SimenB
Copy link
Member

SimenB commented Jun 9, 2018

@budarin
Copy link

budarin commented Jun 9, 2018

@SimenB sorry, not noticed (
but...

    notify: true,
    notifyMode: 'failure',

shows notification if test is passed successfully

 jest: "^23.1.0",
 OS: Windos 7

@thymikee
Copy link
Collaborator

thymikee commented Jul 6, 2018

Closed via #6495

@thymikee thymikee closed this as completed Jul 6, 2018
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants