Skip to content

Commit 69c2977

Browse files
h4lisaacs
authored andcommitted
fix: use 30s default for timeout as per README
PR-URL: #20 Credit: @h4l Close: #20 Reviewed-by: @isaacs
1 parent fe7b129 commit 69c2977

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

config.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ module.exports = figgyPudding({
7575
'scope': {},
7676
'spec': {},
7777
'strict-ssl': {},
78-
'timeout': {},
78+
'timeout': {
79+
default: 30 * 1000
80+
},
7981
'user-agent': {
8082
default: `${
8183
pkg.name

test/config.js

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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+
})
23+
24+
test('default timeout', t => {
25+
const DEFAULT_OPTS = config({})
26+
t.equal(DEFAULT_OPTS.timeout, 30 * 1000, 'default timeout is 30s')
27+
const SPECIFIED_OPTS = config({
28+
timeout: 15 * 1000
29+
})
30+
t.equal(SPECIFIED_OPTS.timeout, 15 * 1000, 'default timeout can be overridden')
31+
t.end()
32+
})

0 commit comments

Comments
 (0)