File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -43,11 +43,13 @@ const publish = async args => {
4343 } )
4444 }
4545
46- const creds = npm . config . getCredentialsByURI ( registry )
47- if ( ! creds . token && ! creds . username ) {
48- throw Object . assign ( new Error ( 'This command requires you to be logged in.' ) , {
49- code : 'ENEEDAUTH' ,
50- } )
46+ if ( ! opts . dryRun ) {
47+ const creds = npm . config . getCredentialsByURI ( registry )
48+ if ( ! creds . token && ! creds . username ) {
49+ throw Object . assign ( new Error ( 'This command requires you to be logged in.' ) , {
50+ code : 'ENEEDAUTH' ,
51+ } )
52+ }
5153 }
5254
5355 if ( semver . validRange ( defaultTag ) )
Original file line number Diff line number Diff line change @@ -193,7 +193,11 @@ t.test('should log tarball contents', (t) => {
193193 dryRun : true ,
194194 registry : 'https://registry.npmjs.org/' ,
195195 } ,
196- config,
196+ config : {
197+ ...config ,
198+ getCredentialsByURI : ( ) => {
199+ throw new Error ( 'should not call getCredentialsByURI!' )
200+ } } ,
197201 } ,
198202 '../../lib/utils/tar.js' : {
199203 getContents : ( ) => ( {
You can’t perform that action at this time.
0 commit comments