Files: e9d9dec1d00ff365112ca0f981bbda15e3682528 / test / test-79-npm / update-notifier / update-notifier.js
753 bytesRaw
1 | ; |
2 | |
3 | // anyway testing in ci |
4 | require('ci-info').isCI = false; |
5 | |
6 | var spawnWasCalled; |
7 | var save = require('child_process').spawn; |
8 | require('child_process').spawn = function () { |
9 | spawnWasCalled = true; |
10 | return save.apply(this, arguments); // eslint-disable-line prefer-rest-params |
11 | }; |
12 | |
13 | var updateNotifier = require('update-notifier'); |
14 | var pjson = { name: 'pkg', version: '3.0.0' }; |
15 | var notifier; |
16 | |
17 | function runNotifier () { |
18 | notifier = updateNotifier({ |
19 | pkg: pjson, |
20 | updateCheckInterval: 0 |
21 | }); |
22 | setTimeout(function () { |
23 | if (spawnWasCalled && |
24 | notifier.update && |
25 | notifier.update.current === '3.0.0') { |
26 | console.log('ok'); |
27 | process.exit(0); |
28 | } else { |
29 | runNotifier(); |
30 | } |
31 | }, 1984); |
32 | } |
33 | |
34 | runNotifier(); |
35 |
Built with git-ssb-web