Skip to content

Commit 8b43c96

Browse files

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

lib/ci.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict'
22

3+
const npm = require('./npm.js')
34
const Installer = require('libcipm')
4-
const npmConfig = require('./config/figgy-config.js')
55
const npmlog = require('npmlog')
66

77
ci.usage = 'npm ci'
@@ -10,7 +10,13 @@ ci.completion = (cb) => cb(null, [])
1010

1111
module.exports = ci
1212
function ci (args, cb) {
13-
return new Installer(npmConfig({ log: npmlog })).run().then(details => {
13+
const opts = Object.create({ log: npmlog })
14+
for (const key in npm.config.list[0]) {
15+
if (key !== 'log') {
16+
opts[key] = npm.config.list[0][key]
17+
}
18+
}
19+
return new Installer(opts).run().then(details => {
1420
npmlog.disableProgress()
1521
console.log(`added ${details.pkgCount} packages in ${
1622
details.runTime / 1000

test/tap/ci.js

+10-2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ const EXEC_OPTS = { cwd: testDir }
1919
const PKG = {
2020
name: 'top',
2121
version: '1.2.3',
22+
scripts: {
23+
install: 'node -p process.env.npm_config_foo'
24+
},
2225
dependencies: {
2326
optimist: '0.6.0',
2427
clean: '2.1.6'
@@ -77,6 +80,7 @@ test('basic installation', (t) => {
7780
.then(() => fixture.create(testDir))
7881
.then(() => common.npm([
7982
'ci',
83+
'--foo=asdf',
8084
'--registry', common.registry,
8185
'--loglevel', 'warn'
8286
], EXEC_OPTS))
@@ -88,7 +92,7 @@ test('basic installation', (t) => {
8892
t.equal(stderr.trim(), '', 'no output on stderr')
8993
t.match(
9094
stdout.trim(),
91-
/^added 6 packages in \d+(?:\.\d+)?s$/,
95+
/\nasdf\nadded 6 packages in \d+(?:\.\d+)?s$/,
9296
'no warnings on stderr, and final output has right number of packages'
9397
)
9498
return fs.readdirAsync(path.join(testDir, 'node_modules'))
@@ -144,6 +148,7 @@ test('supports npm-shrinkwrap.json as well', (t) => {
144148
.then(() => fixture.create(testDir))
145149
.then(() => common.npm([
146150
'ci',
151+
'--foo=asdf',
147152
'--registry', common.registry,
148153
'--loglevel', 'warn'
149154
], EXEC_OPTS))
@@ -155,7 +160,7 @@ test('supports npm-shrinkwrap.json as well', (t) => {
155160
t.equal(stderr.trim(), '', 'no output on stderr')
156161
t.match(
157162
stdout.trim(),
158-
/^added 6 packages in \d+(?:\.\d+)?s$/,
163+
/\nasdf\nadded 6 packages in \d+(?:\.\d+)?s$/,
159164
'no warnings on stderr, and final output has right number of packages'
160165
)
161166
})
@@ -194,6 +199,7 @@ test('removes existing node_modules/ before installing', (t) => {
194199
.then(() => fixture.create(testDir))
195200
.then(() => common.npm([
196201
'ci',
202+
'--foo=asdf',
197203
'--registry', common.registry,
198204
'--loglevel', 'warn'
199205
], EXEC_OPTS))
@@ -232,6 +238,7 @@ test('errors if package-lock.json missing', (t) => {
232238
.then(() => fixture.create(testDir))
233239
.then(() => common.npm([
234240
'ci',
241+
'--foo=asdf',
235242
'--registry', common.registry,
236243
'--loglevel', 'warn'
237244
], EXEC_OPTS))
@@ -268,6 +275,7 @@ test('errors if package-lock.json invalid', (t) => {
268275
.then(() => fixture.create(testDir))
269276
.then(() => common.npm([
270277
'ci',
278+
'--foo=asdf',
271279
'--registry', common.registry,
272280
'--loglevel', 'warn'
273281
], EXEC_OPTS))

0 commit comments

Comments
 (0)