1- import { promisify } from 'util' ;
21import { writeJson , readFile , appendFile } from 'fs-extra' ;
32import test from 'ava' ;
43import execa from 'execa' ;
@@ -68,7 +67,7 @@ test.after.always(async () => {
6867test . serial ( 'Throws error if NPM token is invalid' , async t => {
6968 process . env . NPM_TOKEN = 'wrong_token' ;
7069 const error = await t . throws (
71- promisify ( t . context . m . verifyConditions ) ( { } , { pkg : { name : 'invalid-token' } , logger : t . context . logger } )
70+ t . context . m . verifyConditions ( { } , { pkg : { name : 'invalid-token' } , logger : t . context . logger } )
7271 ) ;
7372
7473 t . true ( error instanceof SemanticReleaseError ) ;
@@ -82,7 +81,7 @@ test.serial('Throws error if NPM token is invalid', async t => {
8281test . serial ( 'Verify npm auth and package' , async t => {
8382 Object . assign ( process . env , npmRegistry . authEnv ) ;
8483 const pkg = { name : 'valid-token' , publishConfig : { registry : npmRegistry . url } } ;
85- await t . notThrows ( promisify ( t . context . m . verifyConditions ) ( { } , { pkg, logger : t . context . logger } ) ) ;
84+ await t . notThrows ( t . context . m . verifyConditions ( { } , { pkg, logger : t . context . logger } ) ) ;
8685
8786 const npmrc = ( await readFile ( '.npmrc' ) ) . toString ( ) ;
8887 t . regex ( npmrc , / _ a u t h = / ) ;
@@ -92,7 +91,7 @@ test.serial('Verify npm auth and package', async t => {
9291test . serial ( 'Return nothing if no version if published' , async t => {
9392 Object . assign ( process . env , npmRegistry . authEnv ) ;
9493 const pkg = { name : 'not-published' , publishConfig : { registry : npmRegistry . url } } ;
95- const nextRelease = await promisify ( t . context . m . getLastRelease ) ( { } , { pkg, logger : t . context . logger } ) ;
94+ const nextRelease = await t . context . m . getLastRelease ( { } , { pkg, logger : t . context . logger } ) ;
9695
9796 t . deepEqual ( nextRelease , { } ) ;
9897} ) ;
@@ -111,7 +110,7 @@ test.serial('Return last version published', async t => {
111110
112111 await execa ( 'npm' , [ 'publish' ] ) ;
113112
114- const nextRelease = await promisify ( t . context . m . getLastRelease ) ( { } , { pkg, logger : t . context . logger } ) ;
113+ const nextRelease = await t . context . m . getLastRelease ( { } , { pkg, logger : t . context . logger } ) ;
115114 t . is ( nextRelease . version , '1.0.0' ) ;
116115} ) ;
117116
@@ -134,7 +133,7 @@ test.serial('Return last version published on a dist-tag', async t => {
134133 // Publish version 1.1.0 on next
135134 await execa ( 'npm' , [ 'publish' , '--tag=next' ] ) ;
136135
137- const nextRelease = await promisify ( t . context . m . getLastRelease ) ( { } , { pkg, logger : t . context . logger } ) ;
136+ const nextRelease = await t . context . m . getLastRelease ( { } , { pkg, logger : t . context . logger } ) ;
138137 t . is ( nextRelease . version , '1.1.0' ) ;
139138} ) ;
140139
@@ -153,7 +152,7 @@ test.serial('Return nothing for an unpublished package', async t => {
153152 await execa ( 'npm' , [ 'publish' ] ) ;
154153 await execa ( 'npm' , [ 'unpublish' , 'unpublished' , '--force' ] ) ;
155154
156- const nextRelease = await promisify ( t . context . m . getLastRelease ) ( { } , { pkg, logger : t . context . logger } ) ;
155+ const nextRelease = await t . context . m . getLastRelease ( { } , { pkg, logger : t . context . logger } ) ;
157156 t . deepEqual ( nextRelease , { } ) ;
158157} ) ;
159158
@@ -162,7 +161,7 @@ test.serial('Publish a package', async t => {
162161 const pkg = { name : 'publish' , version : '1.0.0' , publishConfig : { registry : npmRegistry . url } } ;
163162 await writeJson ( './package.json' , pkg ) ;
164163
165- await promisify ( t . context . m . publish ) ( { } , { pkg, logger : t . context . logger , nextRelease : { version : '1.0.0' } } ) ;
164+ await t . context . m . publish ( { } , { pkg, logger : t . context . logger , nextRelease : { version : '1.0.0' } } ) ;
166165
167166 t . is ( ( await execa ( 'npm' , [ 'view' , 'publish' , 'version' ] ) ) . stdout , '1.0.0' ) ;
168167} ) ;
@@ -172,13 +171,13 @@ test.serial('Verify token and set up auth only on the fist call', async t => {
172171 const pkg = { name : 'test-module' , version : '0.0.0-dev' , publishConfig : { registry : npmRegistry . url } } ;
173172 await writeJson ( './package.json' , pkg ) ;
174173
175- await t . notThrows ( promisify ( t . context . m . verifyConditions ) ( { } , { pkg, logger : t . context . logger } ) ) ;
174+ await t . notThrows ( t . context . m . verifyConditions ( { } , { pkg, logger : t . context . logger } ) ) ;
176175
177- let nextRelease = await promisify ( t . context . m . getLastRelease ) ( { } , { pkg, logger : t . context . logger } ) ;
176+ let nextRelease = await t . context . m . getLastRelease ( { } , { pkg, logger : t . context . logger } ) ;
178177 t . deepEqual ( nextRelease , { } ) ;
179178
180- await promisify ( t . context . m . publish ) ( { } , { pkg, logger : t . context . logger , nextRelease : { version : '1.0.0' } } ) ;
179+ await t . context . m . publish ( { } , { pkg, logger : t . context . logger , nextRelease : { version : '1.0.0' } } ) ;
181180
182- nextRelease = await promisify ( t . context . m . getLastRelease ) ( { } , { pkg, logger : t . context . logger } ) ;
181+ nextRelease = await t . context . m . getLastRelease ( { } , { pkg, logger : t . context . logger } ) ;
183182 t . is ( nextRelease . version , '1.0.0' ) ;
184183} ) ;
0 commit comments