1
1
import test from "ava" ;
2
+ import conventionalChangelogAngular from "conventional-changelog-angular" ;
2
3
import loadChangelogConfig from "../lib/load-changelog-config.js" ;
3
4
4
5
const cwd = process . cwd ( ) ;
@@ -42,7 +43,7 @@ loadConfig.title = (providedTitle, config) => `${providedTitle} Load "${config}"
42
43
43
44
test ( 'Load "conventional-changelog-angular" by default' , async ( t ) => {
44
45
const changelogConfig = await loadChangelogConfig ( { } , { cwd } ) ;
45
- const angularChangelogConfig = await ( await import ( "conventional-changelog-angular" ) ) . default ;
46
+ const angularChangelogConfig = await conventionalChangelogAngular ( ) ;
46
47
47
48
t . deepEqual ( changelogConfig . parserOpts , angularChangelogConfig . parserOpts ) ;
48
49
t . deepEqual ( changelogConfig . writerOpts , angularChangelogConfig . writerOpts ) ;
@@ -54,7 +55,7 @@ test('Accept a "parserOpts" object as option', async (t) => {
54
55
headerCorrespondence : [ "tag" , "shortDesc" ] ,
55
56
} ;
56
57
const changelogConfig = await loadChangelogConfig ( { parserOpts : customParserOptions } , { cwd } ) ;
57
- const angularChangelogConfig = await ( await import ( "conventional-changelog-angular" ) ) . default ;
58
+ const angularChangelogConfig = await conventionalChangelogAngular ( ) ;
58
59
59
60
t . is ( customParserOptions . headerPattern , changelogConfig . parserOpts . headerPattern ) ;
60
61
t . deepEqual ( customParserOptions . headerCorrespondence , changelogConfig . parserOpts . headerCorrespondence ) ;
@@ -65,7 +66,7 @@ test('Accept a "parserOpts" object as option', async (t) => {
65
66
test ( 'Accept a "writerOpts" object as option' , async ( t ) => {
66
67
const customWriterOptions = { commitGroupsSort : "title" , commitsSort : [ "scope" , "subject" ] } ;
67
68
const changelogConfig = await loadChangelogConfig ( { writerOpts : customWriterOptions } , { cwd } ) ;
68
- const angularChangelogConfig = await ( await import ( "conventional-changelog-angular" ) ) . default ;
69
+ const angularChangelogConfig = await conventionalChangelogAngular ( ) ;
69
70
70
71
t . is ( customWriterOptions . commitGroupsSort , changelogConfig . writerOpts . commitGroupsSort ) ;
71
72
t . deepEqual ( customWriterOptions . commitsSort , changelogConfig . writerOpts . commitsSort ) ;
@@ -79,7 +80,7 @@ test('Accept a partial "parserOpts" object as option that overwrite a preset', a
79
80
headerCorrespondence : [ "tag" , "shortDesc" ] ,
80
81
} ;
81
82
const changelogConfig = await loadChangelogConfig ( { parserOpts : customParserOptions , preset : "angular" } , { cwd } ) ;
82
- const angularChangelogConfig = await ( await import ( "conventional-changelog-angular" ) ) . default ;
83
+ const angularChangelogConfig = await conventionalChangelogAngular ( ) ;
83
84
84
85
t . is ( customParserOptions . headerPattern , changelogConfig . parserOpts . headerPattern ) ;
85
86
t . deepEqual ( customParserOptions . headerCorrespondence , changelogConfig . parserOpts . headerCorrespondence ) ;
@@ -90,7 +91,7 @@ test('Accept a partial "parserOpts" object as option that overwrite a preset', a
90
91
test ( 'Accept a "writerOpts" object as option that overwrite a preset' , async ( t ) => {
91
92
const customWriterOptions = { commitGroupsSort : "title" , commitsSort : [ "scope" , "subject" ] } ;
92
93
const changelogConfig = await loadChangelogConfig ( { writerOpts : customWriterOptions , preset : "angular" } , { cwd } ) ;
93
- const angularChangelogConfig = await ( await import ( "conventional-changelog-angular" ) ) . default ;
94
+ const angularChangelogConfig = await conventionalChangelogAngular ( ) ;
94
95
95
96
t . is ( customWriterOptions . commitGroupsSort , changelogConfig . writerOpts . commitGroupsSort ) ;
96
97
t . deepEqual ( customWriterOptions . commitsSort , changelogConfig . writerOpts . commitsSort ) ;
@@ -110,7 +111,7 @@ test('Accept a partial "parserOpts" object as option that overwrite a config', a
110
111
} ,
111
112
{ cwd }
112
113
) ;
113
- const angularChangelogConfig = await ( await import ( "conventional-changelog-angular" ) ) . default ;
114
+ const angularChangelogConfig = await conventionalChangelogAngular ( ) ;
114
115
115
116
t . is ( customParserOptions . headerPattern , changelogConfig . parserOpts . headerPattern ) ;
116
117
t . deepEqual ( customParserOptions . headerCorrespondence , changelogConfig . parserOpts . headerCorrespondence ) ;
@@ -127,7 +128,7 @@ test('Accept a "writerOpts" object as option that overwrite a config', async (t)
127
128
} ,
128
129
{ cwd }
129
130
) ;
130
- const angularChangelogConfig = await ( await import ( "conventional-changelog-angular" ) ) . default ;
131
+ const angularChangelogConfig = await conventionalChangelogAngular ( ) ;
131
132
132
133
t . is ( customWriterOptions . commitGroupsSort , changelogConfig . writerOpts . commitGroupsSort ) ;
133
134
t . deepEqual ( customWriterOptions . commitsSort , changelogConfig . writerOpts . commitsSort ) ;
0 commit comments