File tree 2 files changed +37
-1
lines changed
2 files changed +37
-1
lines changed Original file line number Diff line number Diff line change
1
+ 'use strict'
2
+
3
+ const config = require ( '../config.js' )
4
+ const npmlog = require ( 'npmlog' )
5
+ const { test } = require ( 'tap' )
6
+
7
+ npmlog . level = process . env . LOGLEVEL || 'silent'
8
+
9
+ test ( 'isFromCI config option' , t => {
10
+ const CI = process . env . CI
11
+ process . env . CI = false
12
+ t . teardown ( t => {
13
+ process . env . CI = CI
14
+ } )
15
+ const OPTS = config ( {
16
+ log : npmlog ,
17
+ timeout : 0 ,
18
+ registry : 'https://mock.reg/'
19
+ } )
20
+ t . notOk ( OPTS . isFromCI , 'should be false if not on a CI env' )
21
+ t . end ( )
22
+ } )
Original file line number Diff line number Diff line change @@ -440,9 +440,23 @@ test('log warning header info', t => {
440
440
. then ( res => t . equal ( res . status , 200 , 'got successful response' ) )
441
441
} )
442
442
443
+ test ( 'npm-in-ci header with forced CI=false' , t => {
444
+ const CI = process . env . CI
445
+ process . env . CI = false
446
+ t . teardown ( t => {
447
+ process . env . CI = CI
448
+ } )
449
+ tnock ( t , OPTS . registry )
450
+ . get ( '/hello' )
451
+ . reply ( 200 , { hello : 'world' } )
452
+ return fetch ( '/hello' , OPTS )
453
+ . then ( res => {
454
+ t . equal ( res . status , 200 , 'got successful response' )
455
+ } )
456
+ } )
457
+
443
458
// TODO
444
459
// * npm-session
445
- // * npm-in-ci
446
460
// * npm-scope
447
461
// * referer (opts.refer)
448
462
// * user-agent
You can’t perform that action at this time.
0 commit comments