Skip to content

Commit 38d5679

Browse files
SimenBsindresorhus
authored andcommittedOct 30, 2017
Disable on CI (#116)
1 parent 3e5cea0 commit 38d5679

File tree

4 files changed

+12
-1
lines changed

4 files changed

+12
-1
lines changed
 

‎index.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const isNpm = importLazy('is-npm');
1212
const isInstalledGlobally = importLazy('is-installed-globally');
1313
const boxen = importLazy('boxen');
1414
const xdgBasedir = importLazy('xdg-basedir');
15+
const isCi = importLazy('is-ci');
1516
const ONE_DAY = 1000 * 60 * 60 * 24;
1617

1718
class UpdateNotifier {
@@ -37,7 +38,8 @@ class UpdateNotifier {
3738
this.hasCallback = typeof options.callback === 'function';
3839
this.callback = options.callback || (() => {});
3940
this.disabled = 'NO_UPDATE_NOTIFIER' in process.env ||
40-
process.argv.indexOf('--no-update-notifier') !== -1;
41+
process.argv.indexOf('--no-update-notifier') !== -1 ||
42+
isCi();
4143

4244
if (!this.disabled && !this.hasCallback) {
4345
try {

‎package.json

+2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"chalk": "^2.0.1",
3838
"configstore": "^3.0.0",
3939
"import-lazy": "^2.1.0",
40+
"is-ci": "^1.0.10",
4041
"is-installed-globally": "^0.1.0",
4142
"is-npm": "^1.0.0",
4243
"latest-version": "^3.0.0",
@@ -47,6 +48,7 @@
4748
"ava": "*",
4849
"clear-module": "^2.1.0",
4950
"fixture-stdout": "^0.2.1",
51+
"mock-require": "^2.0.2",
5052
"strip-ansi": "^4.0.0",
5153
"xo": "^0.18.2"
5254
}

‎readme.md

+2
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,8 @@ Users of your module have the ability to opt-out of the update notifier by chang
159159

160160
Users can also opt-out by [setting the environment variable](https://github.com/sindresorhus/guides/blob/master/set-environment-variables.md) `NO_UPDATE_NOTIFIER` with any value or by using the `--no-update-notifier` flag on a per run basis.
161161

162+
The check is also skipped on CI automatically.
163+
162164

163165
## About
164166

‎test/update-notifier.js

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
import fs from 'fs';
22
import test from 'ava';
3+
import mockRequire from 'mock-require';
4+
5+
mockRequire('is-ci', false);
6+
7+
// eslint-disable-next-line import/first
38
import updateNotifier from '..';
49

510
const generateSettings = options => {

0 commit comments

Comments
 (0)
Please sign in to comment.