@@ -66,9 +66,9 @@ test.after.always(async () => {
6666
6767test . serial ( 'Throws error if NPM token is invalid' , async t => {
6868 process . env . NPM_TOKEN = 'wrong_token' ;
69- const error = await t . throws (
70- t . context . m . verifyConditions ( { } , { pkg : { name : 'invalid-token' } , logger : t . context . logger } )
71- ) ;
69+ const pkg = { name : 'published' , version : '1.0.0' , publishConfig : { registry : npmRegistry . url } } ;
70+ await writeJson ( './package.json' , pkg ) ;
71+ const error = await t . throws ( t . context . m . verifyConditions ( { } , { logger : t . context . logger } ) ) ;
7272
7373 t . true ( error instanceof SemanticReleaseError ) ;
7474 t . is ( error . code , 'EINVALIDNPMTOKEN' ) ;
@@ -81,7 +81,8 @@ test.serial('Throws error if NPM token is invalid', async t => {
8181test . serial ( 'Verify npm auth and package' , async t => {
8282 Object . assign ( process . env , npmRegistry . authEnv ) ;
8383 const pkg = { name : 'valid-token' , publishConfig : { registry : npmRegistry . url } } ;
84- await t . notThrows ( t . context . m . verifyConditions ( { } , { pkg, logger : t . context . logger } ) ) ;
84+ await writeJson ( './package.json' , pkg ) ;
85+ await t . notThrows ( t . context . m . verifyConditions ( { } , { logger : t . context . logger } ) ) ;
8586
8687 const npmrc = ( await readFile ( '.npmrc' ) ) . toString ( ) ;
8788 t . regex ( npmrc , / _ a u t h = / ) ;
@@ -91,7 +92,8 @@ test.serial('Verify npm auth and package', async t => {
9192test . serial ( 'Return nothing if no version if published' , async t => {
9293 Object . assign ( process . env , npmRegistry . authEnv ) ;
9394 const pkg = { name : 'not-published' , publishConfig : { registry : npmRegistry . url } } ;
94- const nextRelease = await t . context . m . getLastRelease ( { } , { pkg, logger : t . context . logger } ) ;
95+ await writeJson ( './package.json' , pkg ) ;
96+ const nextRelease = await t . context . m . getLastRelease ( { } , { logger : t . context . logger } ) ;
9597
9698 t . deepEqual ( nextRelease , { } ) ;
9799} ) ;
@@ -110,7 +112,7 @@ test.serial('Return last version published', async t => {
110112
111113 await execa ( 'npm' , [ 'publish' ] ) ;
112114
113- const nextRelease = await t . context . m . getLastRelease ( { } , { pkg , logger : t . context . logger } ) ;
115+ const nextRelease = await t . context . m . getLastRelease ( { } , { logger : t . context . logger } ) ;
114116 t . is ( nextRelease . version , '1.0.0' ) ;
115117} ) ;
116118
@@ -133,7 +135,7 @@ test.serial('Return last version published on a dist-tag', async t => {
133135 // Publish version 1.1.0 on next
134136 await execa ( 'npm' , [ 'publish' , '--tag=next' ] ) ;
135137
136- const nextRelease = await t . context . m . getLastRelease ( { } , { pkg , logger : t . context . logger } ) ;
138+ const nextRelease = await t . context . m . getLastRelease ( { } , { logger : t . context . logger } ) ;
137139 t . is ( nextRelease . version , '1.1.0' ) ;
138140} ) ;
139141
@@ -152,7 +154,7 @@ test.serial('Return nothing for an unpublished package', async t => {
152154 await execa ( 'npm' , [ 'publish' ] ) ;
153155 await execa ( 'npm' , [ 'unpublish' , 'unpublished' , '--force' ] ) ;
154156
155- const nextRelease = await t . context . m . getLastRelease ( { } , { pkg , logger : t . context . logger } ) ;
157+ const nextRelease = await t . context . m . getLastRelease ( { } , { logger : t . context . logger } ) ;
156158 t . deepEqual ( nextRelease , { } ) ;
157159} ) ;
158160
@@ -161,7 +163,7 @@ test.serial('Publish a package', async t => {
161163 const pkg = { name : 'publish' , version : '1.0.0' , publishConfig : { registry : npmRegistry . url } } ;
162164 await writeJson ( './package.json' , pkg ) ;
163165
164- await t . context . m . publish ( { } , { pkg , logger : t . context . logger , nextRelease : { version : '1.0.0' } } ) ;
166+ await t . context . m . publish ( { } , { logger : t . context . logger , nextRelease : { version : '1.0.0' } } ) ;
165167
166168 t . is ( ( await execa ( 'npm' , [ 'view' , 'publish' , 'version' ] ) ) . stdout , '1.0.0' ) ;
167169} ) ;
@@ -171,13 +173,13 @@ test.serial('Verify token and set up auth only on the fist call', async t => {
171173 const pkg = { name : 'test-module' , version : '0.0.0-dev' , publishConfig : { registry : npmRegistry . url } } ;
172174 await writeJson ( './package.json' , pkg ) ;
173175
174- await t . notThrows ( t . context . m . verifyConditions ( { } , { pkg , logger : t . context . logger } ) ) ;
176+ await t . notThrows ( t . context . m . verifyConditions ( { } , { logger : t . context . logger } ) ) ;
175177
176- let nextRelease = await t . context . m . getLastRelease ( { } , { pkg , logger : t . context . logger } ) ;
178+ let nextRelease = await t . context . m . getLastRelease ( { } , { logger : t . context . logger } ) ;
177179 t . deepEqual ( nextRelease , { } ) ;
178180
179- await t . context . m . publish ( { } , { pkg , logger : t . context . logger , nextRelease : { version : '1.0.0' } } ) ;
181+ await t . context . m . publish ( { } , { logger : t . context . logger , nextRelease : { version : '1.0.0' } } ) ;
180182
181- nextRelease = await t . context . m . getLastRelease ( { } , { pkg , logger : t . context . logger } ) ;
183+ nextRelease = await t . context . m . getLastRelease ( { } , { logger : t . context . logger } ) ;
182184 t . is ( nextRelease . version , '1.0.0' ) ;
183185} ) ;
0 commit comments