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 ( '..' ) ;
44
55const cwd = process . cwd ( ) ;
66
@@ -234,7 +234,7 @@ test('Process rules in order and apply highest match', async t => {
234234 t . true ( t . context . log . calledWith ( 'Analysis of %s commits complete: %s release' , 2 , 'minor' ) ) ;
235235} ) ;
236236
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 => {
238238 const commits = [
239239 { hash : '123' , message : 'Chore: First chore (fixes #123)' } ,
240240 { 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 => {
351351} ) ;
352352
353353test ( '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+ } ) ;
358357} ) ;
359358
360359test ( '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+ } ) ;
365363} ) ;
366364
367365test ( 'Throw error if "config" doesn`t exist' , async t => {
@@ -372,13 +370,12 @@ test('Throw error if "config" doesn`t exist', async t => {
372370} ) ;
373371
374372test ( '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+ } ) ;
379376} ) ;
380377
381- test ( 'Re-Throw error from "conventional-changelog-parser"' , async t => {
378+ test ( 'Re-Throw error = require( "conventional-changelog-parser"' , async t => {
382379 const commits = [ { message : 'Fix: First fix (fixes #123)' } , { message : 'Update: Second feature (fixes #456)' } ] ;
383380 await t . throwsAsync ( analyzeCommits ( { parserOpts : { headerPattern : '\\' } } , { cwd, commits, logger : t . context . logger } ) ) ;
384381} ) ;
0 commit comments