You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a binary is being tested, update-notifier should probably not be called since:
this would not work with snapshot testing, where the binary output is expected to match a specific string
this might make tests fail if update-notifier throws an error (e.g. if there is no network connection)
this makes tests slower
this adds no value (since only package maintainers run tests and do not need to be notified about new versions)
Now, knowing whether update-notifier is currently run inside a test might be tricky.
I think one naive approach which might cover some test runners would be to check for NODE_ENV. I.e. if process.env.NODE_ENV === 'test', disable update-notifier (like this is currently done with is-ci).
Note: I can provide with a PR.
What do you think?
The text was updated successfully, but these errors were encountered:
I think one naive approach which might cover some test runners would be to check for NODE_ENV. I.e. if process.env.NODE_ENV === 'test', disable update-notifier (like this is currently done with is-ci).
👍 The behavior should be clearly documented though.
When a binary is being tested,
update-notifier
should probably not be called since:update-notifier
throws an error (e.g. if there is no network connection)Now, knowing whether
update-notifier
is currently run inside a test might be tricky.I think one naive approach which might cover some test runners would be to check for
NODE_ENV
. I.e. ifprocess.env.NODE_ENV === 'test'
, disableupdate-notifier
(like this is currently done withis-ci
).Note: I can provide with a PR.
What do you think?
The text was updated successfully, but these errors were encountered: