Skip to content

Commit e992b4a

Browse files
lukekarrysfritzy
authored andcommitted
fixup! fix: show more information during publish dry-run
1 parent 2545065 commit e992b4a

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

test/lib/commands/publish.js

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,18 @@ t.test(
227227
),
228228
})
229229

230+
const npm = mockNpm({
231+
config: { 'dry-run': true, loglevel: 'info' },
232+
output: () => {
233+
t.pass('output fn is called')
234+
},
235+
}, t)
236+
const registry = npm.config.get('registry')
237+
npm.config.getCredentialsByURI = uri => {
238+
t.same(uri, registry, 'gets credentials for expected registry')
239+
return { /* no token will call log.warn */ }
240+
}
241+
230242
const Publish = t.mock('../../../lib/commands/publish.js', {
231243
'../../../lib/utils/tar.js': {
232244
getContents: () => ({
@@ -235,23 +247,19 @@ t.test(
235247
logTar: () => {
236248
t.pass('logTar is called')
237249
},
250+
'proc-log': {
251+
warn (_, msg) {
252+
t.match(msg,
253+
`This command requires you to be logged in to ${registry} (dry-run)`)
254+
},
255+
},
238256
},
239257
libnpmpublish: {
240258
publish: () => {
241259
throw new Error('should not call libnpmpublish in dry run')
242260
},
243261
},
244262
})
245-
const npm = mockNpm({
246-
config: { 'dry-run': true, loglevel: 'info' },
247-
output: () => {
248-
t.pass('output fn is called')
249-
},
250-
}, t)
251-
npm.config.getCredentialsByURI = uri => {
252-
t.same(uri, npm.config.get('registry'), 'gets credentials for expected registry')
253-
return { token: 'some.registry.token' }
254-
}
255263

256264
const publish = new Publish(npm)
257265

0 commit comments

Comments
 (0)