File tree 2 files changed +12
-6
lines changed
2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -43,11 +43,13 @@ const publish = async args => {
43
43
} )
44
44
}
45
45
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
+ }
51
53
}
52
54
53
55
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) => {
193
193
dryRun : true ,
194
194
registry : 'https://registry.npmjs.org/' ,
195
195
} ,
196
- config,
196
+ config : {
197
+ ...config ,
198
+ getCredentialsByURI : ( ) => {
199
+ throw new Error ( 'should not call getCredentialsByURI!' )
200
+ } } ,
197
201
} ,
198
202
'../../lib/utils/tar.js' : {
199
203
getContents : ( ) => ( {
You can’t perform that action at this time.
0 commit comments