@@ -26,6 +26,7 @@ test.beforeEach(async t => {
2626delete process . env . NPM_USERNAME ;
2727delete process . env . NPM_PASSWORD ;
2828delete process . env . NPM_EMAIL ;
29+ delete process . env . DEFAULT_NPM_REGISTRY ;
2930// Create a git repository, set the current working directory at the root of the repo
3031await gitRepo ( ) ;
3132await gitCommit ( 'Initial commit' ) ;
@@ -58,6 +59,7 @@ test.serial('Skip npm auth verification if "npmPublish" is false', async t => {
5859
5960test . serial ( 'Throws error if NPM token is invalid' , async t => {
6061process . env . NPM_TOKEN = 'wrong_token' ;
62+ process . env . DEFAULT_NPM_REGISTRY = npmRegistry . url ;
6163const pkg = { name :'published' , version :'1.0.0' , publishConfig :{ registry :npmRegistry . url } } ;
6264await outputJson ( './package.json' , pkg ) ;
6365const error = await t . throws ( t . context . m . verifyConditions ( { } , { options :{ } , logger :t . context . logger } ) ) ;
@@ -70,10 +72,21 @@ test.serial('Throws error if NPM token is invalid', async t => {
7072t . regex ( npmrc , / : _ a u t h T o k e n / ) ;
7173} ) ;
7274
75+ test . serial ( 'Skip Token validation if the registry configured is not the default one' , async t => {
76+ process . env . NPM_TOKEN = 'wrong_token' ;
77+ const pkg = { name :'published' , version :'1.0.0' , publishConfig :{ registry :'http://custom-registry.com/' } } ;
78+ await outputJson ( './package.json' , pkg ) ;
79+ await t . notThrows ( t . context . m . verifyConditions ( { } , { options :{ } , logger :t . context . logger } ) ) ;
80+
81+ const npmrc = ( await readFile ( '.npmrc' ) ) . toString ( ) ;
82+ t . regex ( npmrc , / : _ a u t h T o k e n / ) ;
83+ } ) ;
84+
7385test . serial (
7486'Throws error if NPM token is invalid if "npmPublish" is false and npm plugin used for "getLastRelease"' ,
7587async t => {
7688process . env . NPM_TOKEN = 'wrong_token' ;
89+ process . env . DEFAULT_NPM_REGISTRY = npmRegistry . url ;
7790const pkg = { name :'published' , version :'1.0.0' , publishConfig :{ registry :npmRegistry . url } } ;
7891await outputJson ( './package.json' , pkg ) ;
7992const error = await t . throws (
@@ -96,6 +109,7 @@ test.serial(
96109'Throws error if NPM token is invalid if "npmPublish" is false and npm plugin used for "getLastRelease" as an object' ,
97110async t => {
98111process . env . NPM_TOKEN = 'wrong_token' ;
112+ process . env . DEFAULT_NPM_REGISTRY = npmRegistry . url ;
99113const pkg = { name :'published' , version :'1.0.0' , publishConfig :{ registry :npmRegistry . url } } ;
100114await outputJson ( './package.json' , pkg ) ;
101115const error = await t . throws (