1
- import test from 'ava' ;
2
- import { stub } from 'sinon' ;
3
- import { analyzeCommits } from '..' ;
1
+ const test = require ( 'ava' ) ;
2
+ const { stub} = require ( 'sinon' ) ;
3
+ const { analyzeCommits} = require ( '..' ) ;
4
4
5
5
const cwd = process . cwd ( ) ;
6
6
@@ -234,7 +234,7 @@ test('Process rules in order and apply highest match', async t => {
234
234
t . true ( t . context . log . calledWith ( 'Analysis of %s commits complete: %s release' , 2 , 'minor' ) ) ;
235
235
} ) ;
236
236
237
- test ( 'Process rules in order and apply highest match from config even if default has an higher match' , async t => {
237
+ test ( 'Process rules in order and apply highest match = require( config even if default has an higher match' , async t => {
238
238
const commits = [
239
239
{ hash : '123' , message : 'Chore: First chore (fixes #123)' } ,
240
240
{ hash : '456' , message : 'Docs: update README (fixes #456) \n\n BREAKING CHANGE: break something' } ,
@@ -351,17 +351,15 @@ test('Throw error if "preset" doesn`t exist', async t => {
351
351
} ) ;
352
352
353
353
test ( 'Throw error if "releaseRules" is not an Array or a String' , async t => {
354
- await t . throwsAsync (
355
- analyzeCommits ( { releaseRules : { } } , { cwd} ) ,
356
- / E r r o r i n c o m m i t - a n a l y z e r c o n f i g u r a t i o n : " r e l e a s e R u l e s " m u s t b e a n a r r a y o f r u l e s /
357
- ) ;
354
+ await t . throwsAsync ( analyzeCommits ( { releaseRules : { } } , { cwd} ) , {
355
+ message : / E r r o r i n c o m m i t - a n a l y z e r c o n f i g u r a t i o n : " r e l e a s e R u l e s " m u s t b e a n a r r a y o f r u l e s / ,
356
+ } ) ;
358
357
} ) ;
359
358
360
359
test ( 'Throw error if "releaseRules" option reference a requierable module that is not an Array or a String' , async t => {
361
- await t . throwsAsync (
362
- analyzeCommits ( { releaseRules : './test/fixtures/release-rules-invalid' } , { cwd} ) ,
363
- / E r r o r i n c o m m i t - a n a l y z e r c o n f i g u r a t i o n : " r e l e a s e R u l e s " m u s t b e a n a r r a y o f r u l e s /
364
- ) ;
360
+ await t . throwsAsync ( analyzeCommits ( { releaseRules : './test/fixtures/release-rules-invalid' } , { cwd} ) , {
361
+ message : / E r r o r i n c o m m i t - a n a l y z e r c o n f i g u r a t i o n : " r e l e a s e R u l e s " m u s t b e a n a r r a y o f r u l e s / ,
362
+ } ) ;
365
363
} ) ;
366
364
367
365
test ( 'Throw error if "config" doesn`t exist' , async t => {
@@ -372,13 +370,12 @@ test('Throw error if "config" doesn`t exist', async t => {
372
370
} ) ;
373
371
374
372
test ( 'Throw error if "releaseRules" reference invalid commit type' , async t => {
375
- await t . throwsAsync (
376
- analyzeCommits ( { preset : 'eslint' , releaseRules : [ { tag : 'Update' , release : 'invalid' } ] } , { cwd} ) ,
377
- / E r r o r i n c o m m i t - a n a l y z e r c o n f i g u r a t i o n : " i n v a l i d " i s n o t a v a l i d r e l e a s e t y p e \. V a l i d v a l u e s a r e : \[ ? .* \] /
378
- ) ;
373
+ await t . throwsAsync ( analyzeCommits ( { preset : 'eslint' , releaseRules : [ { tag : 'Update' , release : 'invalid' } ] } , { cwd} ) , {
374
+ message : / E r r o r i n c o m m i t - a n a l y z e r c o n f i g u r a t i o n : " i n v a l i d " i s n o t a v a l i d r e l e a s e t y p e \. V a l i d v a l u e s a r e : \[ ? .* \] / ,
375
+ } ) ;
379
376
} ) ;
380
377
381
- test ( 'Re-Throw error from "conventional-changelog-parser"' , async t => {
378
+ test ( 'Re-Throw error = require( "conventional-changelog-parser"' , async t => {
382
379
const commits = [ { message : 'Fix: First fix (fixes #123)' } , { message : 'Update: Second feature (fixes #456)' } ] ;
383
380
await t . throwsAsync ( analyzeCommits ( { parserOpts : { headerPattern : '\\' } } , { cwd, commits, logger : t . context . logger } ) ) ;
384
381
} ) ;
0 commit comments