@@ -182,3 +182,101 @@ test('run version with --patch flag and make sure patch version is incremented',
182
182
expect ( pkg . version ) . toEqual ( '1.0.1' ) ;
183
183
} ) ;
184
184
} ) ;
185
+
186
+ test ( 'run version with --premajor flag and make sure premajor version is incremented' , ( ) : Promise < void > => {
187
+ return runRun ( [ ] , { gitTagVersion, premajor : true } , 'no-args' , async ( config ) : ?Promise < void > => {
188
+ const pkg = await fs . readJson ( path . join ( config . cwd , 'package.json' ) ) ;
189
+ expect ( pkg . version ) . toEqual ( '2.0.0-0' ) ;
190
+ } ) ;
191
+ } ) ;
192
+
193
+ test ( 'run version with --premajor flag with preid and make sure premajor version is incremented' , ( ) : Promise < void > => {
194
+ return runRun ( [ ] , { gitTagVersion, premajor : true , preid : 'alpha' } , 'no-args' , async ( config ) : ?Promise < void > => {
195
+ const pkg = await fs . readJson ( path . join ( config . cwd , 'package.json' ) ) ;
196
+ expect ( pkg . version ) . toEqual ( '2.0.0-alpha.0' ) ;
197
+ } ) ;
198
+ } ) ;
199
+
200
+ test ( 'run version with --preminor flag and make sure preminor version is incremented' , ( ) : Promise < void > => {
201
+ return runRun ( [ ] , { gitTagVersion, preminor : true } , 'no-args' , async ( config ) : ?Promise < void > => {
202
+ const pkg = await fs . readJson ( path . join ( config . cwd , 'package.json' ) ) ;
203
+ expect ( pkg . version ) . toEqual ( '1.1.0-0' ) ;
204
+ } ) ;
205
+ } ) ;
206
+
207
+ test ( 'run version with --preminor flag with preid and make sure preminor version is incremented' , ( ) : Promise < void > => {
208
+ return runRun ( [ ] , { gitTagVersion, preminor : true , preid : 'alpha' } , 'no-args' , async ( config ) : ?Promise < void > => {
209
+ const pkg = await fs . readJson ( path . join ( config . cwd , 'package.json' ) ) ;
210
+ expect ( pkg . version ) . toEqual ( '1.1.0-alpha.0' ) ;
211
+ } ) ;
212
+ } ) ;
213
+
214
+ test ( 'run version with --prepatch flag and make sure prepatch version is incremented' , ( ) : Promise < void > => {
215
+ return runRun ( [ ] , { gitTagVersion, prepatch : true } , 'no-args' , async ( config ) : ?Promise < void > => {
216
+ const pkg = await fs . readJson ( path . join ( config . cwd , 'package.json' ) ) ;
217
+ expect ( pkg . version ) . toEqual ( '1.0.1-0' ) ;
218
+ } ) ;
219
+ } ) ;
220
+
221
+ test ( 'run version with --prepatch flag with preid and make sure prepatch version is incremented' , ( ) : Promise < void > => {
222
+ return runRun ( [ ] , { gitTagVersion, prepatch : true , preid : 'alpha' } , 'no-args' , async ( config ) : ?Promise < void > => {
223
+ const pkg = await fs . readJson ( path . join ( config . cwd , 'package.json' ) ) ;
224
+ expect ( pkg . version ) . toEqual ( '1.0.1-alpha.0' ) ;
225
+ } ) ;
226
+ } ) ;
227
+
228
+ test ( 'run version with --prerelease flag and make sure prerelease version is incremented' , ( ) : Promise < void > => {
229
+ return runRun ( [ ] , { gitTagVersion, prerelease : true } , 'no-args' , async ( config ) : ?Promise < void > => {
230
+ const pkg = await fs . readJson ( path . join ( config . cwd , 'package.json' ) ) ;
231
+ expect ( pkg . version ) . toEqual ( '1.0.1-0' ) ;
232
+ } ) ;
233
+ } ) ;
234
+
235
+ test ( 'run version with --prerelease flag with preid and make sure prerelease version is incremented' , ( ) : Promise <
236
+ void ,
237
+ > => {
238
+ return runRun ( [ ] , { gitTagVersion, prerelease : true , preid : 'alpha' } , 'no-args' , async ( config ) : ?Promise < void > => {
239
+ const pkg = await fs . readJson ( path . join ( config . cwd , 'package.json' ) ) ;
240
+ expect ( pkg . version ) . toEqual ( '1.0.1-alpha.0' ) ;
241
+ } ) ;
242
+ } ) ;
243
+
244
+ test ( 'run version with --new-version prerelease flag and make sure prerelease version is incremented' , ( ) : Promise <
245
+ void ,
246
+ > => {
247
+ return runRun ( [ ] , { gitTagVersion, newVersion : 'prerelease' } , 'no-args' , async ( config ) : ?Promise < void > => {
248
+ const pkg = await fs . readJson ( path . join ( config . cwd , 'package.json' ) ) ;
249
+ expect ( pkg . version ) . toEqual ( '1.0.1-0' ) ;
250
+ } ) ;
251
+ } ) ;
252
+
253
+ test ( 'run version with --new-version and preid flags and make sure prerelease version is incremented' , ( ) : Promise <
254
+ void ,
255
+ > => {
256
+ return runRun ( [ ] , { gitTagVersion, newVersion : 'prerelease' , preid : 'beta' } , 'no-args' , async ( config ) : ?Promise <
257
+ void ,
258
+ > => {
259
+ const pkg = await fs . readJson ( path . join ( config . cwd , 'package.json' ) ) ;
260
+ expect ( pkg . version ) . toEqual ( '1.0.1-beta.0' ) ;
261
+ } ) ;
262
+ } ) ;
263
+
264
+ test ( 'run version with --new-version and preid flags and make sure premajor version is incremented' , ( ) : Promise <
265
+ void ,
266
+ > => {
267
+ return runRun ( [ ] , { gitTagVersion, newVersion : 'premajor' , preid : 'beta' } , 'no-args' , async ( config ) : ?Promise <
268
+ void ,
269
+ > => {
270
+ const pkg = await fs . readJson ( path . join ( config . cwd , 'package.json' ) ) ;
271
+ expect ( pkg . version ) . toEqual ( '2.0.0-beta.0' ) ;
272
+ } ) ;
273
+ } ) ;
274
+
275
+ test ( 'run version with main release and --new-version and preid flags and make sure identifier is ignored' , ( ) : Promise <
276
+ void ,
277
+ > => {
278
+ return runRun ( [ ] , { gitTagVersion, newVersion : 'major' , preid : 'beta' } , 'no-args' , async ( config ) : ?Promise < void > => {
279
+ const pkg = await fs . readJson ( path . join ( config . cwd , 'package.json' ) ) ;
280
+ expect ( pkg . version ) . toEqual ( '2.0.0' ) ;
281
+ } ) ;
282
+ } ) ;
0 commit comments