@release-it/keep-a-changelog 6.0.0 → 7.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,8 +11,8 @@ jobs:
11
11
  - windows-latest
12
12
  - macos-latest
13
13
  node:
14
- - 18
15
14
  - 20
15
+ - 22
16
16
 
17
17
  runs-on: ${{ matrix.os }}
18
18
  name: ${{ matrix.os }} (Node v${{ matrix.node }})
package/README.md CHANGED
@@ -28,14 +28,14 @@ In [release-it](https://github.com/release-it/release-it) config:
28
28
 
29
29
  ## Options
30
30
 
31
- | option | default value | description |
32
- | ----------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
33
- | filename | `'CHANGELOG.md'` | File with changelogs. |
34
- | addUnreleased | `false` | It leaves "Unreleased" title row if set to `true`. |
35
- | keepUnreleased | `false` | It leaves "Unreleased" title row unchanged if set to `true`. |
36
- | addVersionUrl | `false` | Links the version to the according changeset. Uses GitHub-compatible URLs by default, see other options to configure the URL format. |
37
- | versionUrlFormats | See below. | Determines the version URL format when `addVersionUrl` is set to `true`. Uses GitHub-compatible URLs by default. |
38
- | head | `'HEAD'` | The git revision the new version tag is compared to in the Unreleased URL. |
31
+ | option | default value | description |
32
+ | ----------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
33
+ | filename | `'CHANGELOG.md'` | File with changelogs. |
34
+ | addUnreleased | `false` | It leaves "Unreleased" title row if set to `true`. |
35
+ | keepUnreleased | `false` | It leaves "Unreleased" title row unchanged if set to `true`. |
36
+ | addVersionUrl | `false` | Links the version to the according changeset. Uses GitHub-compatible URLs by default, see other options to configure the URL format. |
37
+ | versionUrlFormats | See below. | Determines the version URL format when `addVersionUrl` is set to `true`. Uses GitHub-compatible URLs by default. |
38
+ | head | `'HEAD'` | The git revision the new version tag is compared to in the Unreleased URL. |
39
39
 
40
40
  ### versionUrlFormats
41
41
 
@@ -60,6 +60,6 @@ The URL formats used when `addVersionUrl` is set to `true`. Example configuratio
60
60
  | option | default value | description |
61
61
  | --------------- | ----------------------------------------------------- | ------------------------------------------------------------------------------------------- |
62
62
  | repositoryUrl | `'https://{host}/{repository}'` | The format of the repository URL. |
63
- | unreleasedUrl | `'{repositoryUrl}/compare/{tagName}...{head}'` | The format of the `[unreleased]` section URL. |
63
+ | unreleasedUrl | `'{repositoryUrl}/compare/{tagName}...{head}'` | The format of the `[Unreleased]` section URL. |
64
64
  | versionUrl | `'{repositoryUrl}/compare/{previousTag}...{tagName}'` | The format of a release version URL. |
65
65
  | firstVersionUrl | `'{repositoryUrl}/releases/tag/{tagName}'` | The format of the first release version URL, i.e. when no previous tags have been released. |
package/index.js CHANGED
@@ -132,11 +132,11 @@ class KeepAChangelog extends Plugin {
132
132
  let updatedChangelog = changelog;
133
133
 
134
134
  const repositoryUrl = format(this.versionUrlFormats.repositoryUrl, repo);
135
- const unreleasedLinkRegex = new RegExp(`\\[unreleased\\]\\:.*${this.head}`, 'i');
135
+ const unreleasedLinkRegex = new RegExp(`\\[Unreleased\\]\\:.*${this.head}`, 'i');
136
136
 
137
137
  // Add or update the Unreleased link
138
138
  const unreleasedUrl = format(this.versionUrlFormats.unreleasedUrl, { repositoryUrl, tagName, head: this.head });
139
- const unreleasedLink = `[unreleased]: ${unreleasedUrl}`;
139
+ const unreleasedLink = `[Unreleased]: ${unreleasedUrl}`;
140
140
  if (unreleasedLinkRegex.test(updatedChangelog)) {
141
141
  updatedChangelog = updatedChangelog.replace(unreleasedLinkRegex, unreleasedLink);
142
142
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@release-it/keep-a-changelog",
3
- "version": "6.0.0",
3
+ "version": "7.0.1",
4
4
  "description": "Keep-a-changelog plugin for release-it",
5
5
  "type": "module",
6
6
  "exports": "./index.js",
@@ -31,21 +31,21 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "detect-newline": "^4.0.1",
34
- "semver": "^7.6.3",
34
+ "semver": "^7.7.4",
35
35
  "string-template": "^1.0.0"
36
36
  },
37
37
  "devDependencies": {
38
38
  "bron": "^2.0.3",
39
- "fs-monkey": "^1.0.6",
40
- "memfs": "^4.15.3",
41
- "release-it": "^18.0.0",
42
- "sinon": "^19.0.2"
39
+ "fs-monkey": "^1.1.0",
40
+ "memfs": "^4.56.10",
41
+ "release-it": "^19.2.4",
42
+ "sinon": "^21.0.1"
43
43
  },
44
44
  "peerDependencies": {
45
- "release-it": "^18.0.0"
45
+ "release-it": "^18.0.0 || ^19.0.0"
46
46
  },
47
47
  "engines": {
48
- "node": ">=18"
48
+ "node": "^20.9.0 || >=22.0.0"
49
49
  },
50
50
  "release-it": {
51
51
  "github": {
package/test.js CHANGED
@@ -13,7 +13,8 @@ const initialDryRunFileContents =
13
13
  vol.fromJSON({
14
14
  './CHANGELOG-FOO.md': '## [FOO]\n\n* Item A\n* Item B',
15
15
  './CHANGELOG-MULTIPLE_UNRELEASED.md': '## [Unreleased]\n* Item A\n\n## [Unreleased]* Item B\nB\n* Item C\n* Item D',
16
- './CHANGELOG-INVALID_ORDER.md': '## [Unreleased]\n\n## [0.2.0]\n* Item A\n\n## [0.3.0]* Item B\nB\n\n## [0.1.0]\n* Item C\n* Item D',
16
+ './CHANGELOG-INVALID_ORDER.md':
17
+ '## [Unreleased]\n\n## [0.2.0]\n* Item A\n\n## [0.3.0]* Item B\nB\n\n## [0.1.0]\n* Item C\n* Item D',
17
18
  './CHANGELOG-EMPTY.md': '## [Unreleased]\n\n\n\n## [1.0.0]\n\n* Item A\n* Item B',
18
19
  './CHANGELOG-FULL.md':
19
20
  '# Changelog\n\n## [Unreleased]\n\n* Item A\n* Item B\n\n## [1.0.0] - 2020-05-02\n\n* Item C\n* Item D',
@@ -23,13 +24,13 @@ vol.fromJSON({
23
24
  '\r\n\r\n## [Unreleased]\r\n\r\n* Item A\r\n* Item B\r\n\r\n## [1.0.0] - 2020-05-02\r\n\r\n* Item C\r\n* Item D',
24
25
  './CHANGELOG-UNRELEASED.md': '## [Unreleased]\n\n* Item A\n* Item B\n\n## [1.0.0] - 2020-05-02\n\n* Item C\n* Item D',
25
26
  './CHANGELOG-VERSION_URL.md':
26
- '## [Unreleased]\n\n* Item A\n* Item B\n\n## [1.0.0] - 2020-05-02\n\n* Item C\n* Item D\n\n[unreleased]: https://github.com/release-it/release-it/compare/1.0.0..HEAD\n[1.0.0]: https://github.com/release-it/release-it/compare/0.0.0...1.0.0',
27
+ '## [Unreleased]\n\n* Item A\n* Item B\n\n## [1.0.0] - 2020-05-02\n\n* Item C\n* Item D\n\n[Unreleased]: https://github.com/release-it/release-it/compare/1.0.0..HEAD\n[1.0.0]: https://github.com/release-it/release-it/compare/0.0.0...1.0.0',
27
28
  './CHANGELOG-VERSION_URL_FORMATS.md':
28
- '## [Unreleased]\n\n* Item A\n* Item B\n\n## [1.0.0] - 2020-05-02\n\n* Item C\n* Item D\n\n[unreleased]: https://github.com/_git/release-it/release-it/compareBranch/1.0.0/HEAD\n[1.0.0]: https://github.com/_git/release-it/release-it/compareBranch/0.0.0/1.0.0',
29
+ '## [Unreleased]\n\n* Item A\n* Item B\n\n## [1.0.0] - 2020-05-02\n\n* Item C\n* Item D\n\n[Unreleased]: https://github.com/_git/release-it/release-it/compareBranch/1.0.0/HEAD\n[1.0.0]: https://github.com/_git/release-it/release-it/compareBranch/0.0.0/1.0.0',
29
30
  './CHANGELOG-VERSION_URL_HEAD.md':
30
- '## [Unreleased]\n\n* Item A\n* Item B\n\n## [1.0.0] - 2020-05-02\n\n* Item C\n* Item D\n\n[unreleased]: https://github.com/release-it/release-it/compare/1.0.0..main\n[1.0.0]: https://github.com/release-it/release-it/compare/0.0.0...1.0.0',
31
+ '## [Unreleased]\n\n* Item A\n* Item B\n\n## [1.0.0] - 2020-05-02\n\n* Item C\n* Item D\n\n[Unreleased]: https://github.com/release-it/release-it/compare/1.0.0..main\n[1.0.0]: https://github.com/release-it/release-it/compare/0.0.0...1.0.0',
31
32
  './CHANGELOG-VERSION_URL_UNRELEASED.md':
32
- '## [Unreleased]\n\n* Item A\n* Item B\n\n## [1.0.0] - 2020-05-02\n\n* Item C\n* Item D\n\n[unreleased]: https://github.com/user/project/compare/1.0.0..HEAD\n[1.0.0]: https://github.com/user/project/compare/0.0.0...1.0.0',
33
+ '## [Unreleased]\n\n* Item A\n* Item B\n\n## [1.0.0] - 2020-05-02\n\n* Item C\n* Item D\n\n[Unreleased]: https://github.com/user/project/compare/1.0.0..HEAD\n[1.0.0]: https://github.com/user/project/compare/0.0.0...1.0.0',
33
34
  './CHANGELOG-VERSION_URL_UNRELEASED_TITLE_CASE.md':
34
35
  '## [Unreleased]\n\n* Item A\n* Item B\n\n## [1.0.0] - 2020-05-02\n\n* Item C\n* Item D\n\n[Unreleased]: https://github.com/user/project/compare/1.0.0..HEAD\n[1.0.0]: https://github.com/user/project/compare/0.0.0...1.0.0',
35
36
  './CHANGELOG-VERSION_URL_NEW.md': '## [Unreleased]\n\n* Item A\n* Item B\n'
@@ -43,63 +44,63 @@ const namespace = 'keep-a-changelog';
43
44
 
44
45
  test('should throw for missing changelog file', async t => {
45
46
  const options = { [namespace]: {} };
46
- const plugin = factory(Plugin, { namespace, options });
47
+ const plugin = await factory(Plugin, { namespace, options });
47
48
  await assert.rejects(runTasks(plugin), /ENOENT: no such file or directory/);
48
49
  });
49
50
 
50
51
  test('should throw for missing "unreleased" section', async t => {
51
52
  const options = { [namespace]: { filename: 'CHANGELOG-FOO.md' } };
52
- const plugin = factory(Plugin, { namespace, options });
53
+ const plugin = await factory(Plugin, { namespace, options });
53
54
  await assert.rejects(runTasks(plugin), /Missing "Unreleased" section in CHANGELOG-FOO.md/);
54
55
  });
55
56
 
56
57
  test('should throw for empty "unreleased" section', async t => {
57
58
  const options = { [namespace]: { filename: 'CHANGELOG-EMPTY.md' } };
58
- const plugin = factory(Plugin, { namespace, options });
59
+ const plugin = await factory(Plugin, { namespace, options });
59
60
  await assert.rejects(runTasks(plugin), /There are no entries under "Unreleased" section in CHANGELOG-EMPTY\.md/);
60
61
  });
61
62
 
62
63
  test('should throw for missing "unreleased" section when no-increment flag is set if changelog is misformatted', async t => {
63
64
  const options = { increment: false, [namespace]: { filename: 'CHANGELOG-FOO.md' } };
64
- const plugin = factory(Plugin, { namespace, options });
65
+ const plugin = await factory(Plugin, { namespace, options });
65
66
  await assert.rejects(runTasks(plugin), /Missing "Unreleased" section in CHANGELOG-FOO.md/);
66
67
  });
67
68
 
68
69
  test('should throw for multiple "unreleased" sections', async t => {
69
70
  const options = { [namespace]: { filename: 'CHANGELOG-MULTIPLE_UNRELEASED.md' } };
70
- const plugin = factory(Plugin, { namespace, options });
71
+ const plugin = await factory(Plugin, { namespace, options });
71
72
  await assert.rejects(runTasks(plugin), /Too many "Unreleased" sections in CHANGELOG-MULTIPLE_UNRELEASED.md: \d+./);
72
73
  });
73
74
  test('should throw for invalid order', async t => {
74
75
  const options = { [namespace]: { filename: 'CHANGELOG-INVALID_ORDER.md' } };
75
- const plugin = factory(Plugin, { namespace, options });
76
+ const plugin = await factory(Plugin, { namespace, options });
76
77
  await assert.rejects(runTasks(plugin), /Invalid sections order in CHANGELOG-INVALID_ORDER.md: 0.2.0, 0.3.0./);
77
78
  });
78
79
 
79
80
  test('should find "1.0.0" section when no-increment flag is set when items under version', async t => {
80
81
  const options = { increment: false, [namespace]: { filename: 'CHANGELOG-EMPTY.md' } };
81
- const plugin = factory(Plugin, { namespace, options });
82
+ const plugin = await factory(Plugin, { namespace, options });
82
83
  await runTasks(plugin);
83
84
  assert.equal(plugin.getChangelog('1.0.0'), '* Item A\n* Item B');
84
85
  });
85
86
 
86
87
  test('should find "1.0.0" section when no-increment flag is set when items under unreleased and version', async t => {
87
88
  const options = { increment: false, [namespace]: { filename: 'CHANGELOG-FULL.md' } };
88
- const plugin = factory(Plugin, { namespace, options });
89
+ const plugin = await factory(Plugin, { namespace, options });
89
90
  await runTasks(plugin);
90
91
  assert.equal(plugin.getChangelog('1.0.0'), '* Item C\n* Item D');
91
92
  });
92
93
 
93
94
  test('should find very first changelog with disabled strict latest option', async t => {
94
95
  const options = { [namespace]: { filename: 'CHANGELOG-UNRELEASED.md', strictLatest: false } };
95
- const plugin = factory(Plugin, { namespace, options });
96
+ const plugin = await factory(Plugin, { namespace, options });
96
97
  await runTasks(plugin);
97
98
  assert.equal(plugin.getChangelog(), '* Item A\n* Item B');
98
99
  });
99
100
 
100
101
  test('should write changelog', async t => {
101
102
  const options = { [namespace]: { filename: 'CHANGELOG-FULL.md' } };
102
- const plugin = factory(Plugin, { namespace, options });
103
+ const plugin = await factory(Plugin, { namespace, options });
103
104
  await runTasks(plugin);
104
105
  assert.equal(plugin.getChangelog(), '* Item A\n* Item B');
105
106
  assert.match(
@@ -110,28 +111,28 @@ test('should write changelog', async t => {
110
111
 
111
112
  test('should not write changelog in dry run', async t => {
112
113
  const options = { 'dry-run': true, [namespace]: { filename: 'CHANGELOG-DRYRUN.md' } };
113
- const plugin = factory(Plugin, { namespace, options });
114
+ const plugin = await factory(Plugin, { namespace, options });
114
115
  await runTasks(plugin);
115
116
  assert.equal(readFile('./CHANGELOG-DRYRUN.md'), initialDryRunFileContents);
116
117
  });
117
118
 
118
119
  test('should not write changelog with keep unreleased option', async t => {
119
120
  const options = { [namespace]: { filename: 'CHANGELOG-DRYRUN.md', keepUnreleased: true } };
120
- const plugin = factory(Plugin, { namespace, options });
121
+ const plugin = await factory(Plugin, { namespace, options });
121
122
  await runTasks(plugin);
122
123
  assert.equal(readFile('./CHANGELOG-DRYRUN.md'), initialDryRunFileContents);
123
124
  });
124
125
 
125
126
  test('should find changelog even if less new lines is used', async t => {
126
127
  const options = { [namespace]: { filename: 'CHANGELOG-LESS_NEW_LINES.md' } };
127
- const plugin = factory(Plugin, { namespace, options });
128
+ const plugin = await factory(Plugin, { namespace, options });
128
129
  await runTasks(plugin);
129
130
  assert.equal(plugin.getChangelog(), '* Item A\n* Item B');
130
131
  });
131
132
 
132
133
  test('should write changelog with different EOL', async t => {
133
134
  const options = { [namespace]: { filename: 'CHANGELOG-EOL.md' } };
134
- const plugin = factory(Plugin, { namespace, options });
135
+ const plugin = await factory(Plugin, { namespace, options });
135
136
  await runTasks(plugin);
136
137
  assert.equal(plugin.getChangelog(), '* Item A\r\n* Item B');
137
138
  assert.match(
@@ -142,7 +143,7 @@ test('should write changelog with different EOL', async t => {
142
143
 
143
144
  test('should write changelog and add unreleased section', async t => {
144
145
  const options = { [namespace]: { filename: 'CHANGELOG-UNRELEASED.md', addUnreleased: true } };
145
- const plugin = factory(Plugin, { namespace, options });
146
+ const plugin = await factory(Plugin, { namespace, options });
146
147
  await runTasks(plugin);
147
148
  assert.equal(plugin.getChangelog(), '* Item A\n* Item B');
148
149
  assert.match(
@@ -153,7 +154,7 @@ test('should write changelog and add unreleased section', async t => {
153
154
 
154
155
  test('should add links to the end of the file', async t => {
155
156
  const options = { [namespace]: { filename: 'CHANGELOG-VERSION_URL.md', addVersionUrl: true } };
156
- const plugin = factory(Plugin, { namespace, options });
157
+ const plugin = await factory(Plugin, { namespace, options });
157
158
  plugin.config.setContext({
158
159
  latestTag: '1.0.0',
159
160
  repo: {
@@ -165,7 +166,7 @@ test('should add links to the end of the file', async t => {
165
166
  assert.equal(plugin.getChangelog(), '* Item A\n* Item B');
166
167
  assert.match(
167
168
  readFile('./CHANGELOG-VERSION_URL.md'),
168
- /^## \[1\.0\.1] - [0-9]{4}-[0-9]{2}-[0-9]{2}\n\n\* Item A\n\* Item B\n\n## \[1\.0\.0] - 2020-05-02\n\n\* Item C\n*\* Item D\n\n\[unreleased]: https:\/\/github\.com\/release-it\/release-it\/compare\/1\.0\.1\.\.\.HEAD\n\[1\.0\.1]: https:\/\/github\.com\/release-it\/release-it\/compare\/1\.0\.0\.\.\.1\.0\.1\n\[1\.0\.0]: https:\/\/github\.com\/release-it\/release-it\/compare\/0\.0\.0\.\.\.1\.0\.0\n$/
169
+ /^## \[1\.0\.1] - [0-9]{4}-[0-9]{2}-[0-9]{2}\n\n\* Item A\n\* Item B\n\n## \[1\.0\.0] - 2020-05-02\n\n\* Item C\n*\* Item D\n\n\[Unreleased]: https:\/\/github\.com\/release-it\/release-it\/compare\/1\.0\.1\.\.\.HEAD\n\[1\.0\.1]: https:\/\/github\.com\/release-it\/release-it\/compare\/1\.0\.0\.\.\.1\.0\.1\n\[1\.0\.0]: https:\/\/github\.com\/release-it\/release-it\/compare\/0\.0\.0\.\.\.1\.0\.0\n$/
169
170
  );
170
171
  });
171
172
 
@@ -181,7 +182,7 @@ test('should add links with custom URL formats to the end of the file', async t
181
182
  }
182
183
  }
183
184
  };
184
- const plugin = factory(Plugin, { namespace, options });
185
+ const plugin = await factory(Plugin, { namespace, options });
185
186
  plugin.config.setContext({
186
187
  latestTag: '1.0.0',
187
188
  repo: {
@@ -193,13 +194,13 @@ test('should add links with custom URL formats to the end of the file', async t
193
194
  assert.equal(plugin.getChangelog(), '* Item A\n* Item B');
194
195
  assert.match(
195
196
  readFile('./CHANGELOG-VERSION_URL_FORMATS.md'),
196
- /^## \[1\.0\.1] - [0-9]{4}-[0-9]{2}-[0-9]{2}\n\n\* Item A\n\* Item B\n\n## \[1\.0\.0] - 2020-05-02\n\n\* Item C\n*\* Item D\n\n\[unreleased]: https:\/\/github\.com\/_git\/release-it\/release-it\/compareBranch\/1\.0\.1\/HEAD\n\[1\.0\.1]: https:\/\/github\.com\/_git\/release-it\/release-it\/compareBranch\/1\.0\.0\/1\.0\.1\n\[1\.0\.0]: https:\/\/github\.com\/_git\/release-it\/release-it\/compareBranch\/0\.0\.0\/1\.0\.0\n$/
197
+ /^## \[1\.0\.1] - [0-9]{4}-[0-9]{2}-[0-9]{2}\n\n\* Item A\n\* Item B\n\n## \[1\.0\.0] - 2020-05-02\n\n\* Item C\n*\* Item D\n\n\[Unreleased]: https:\/\/github\.com\/_git\/release-it\/release-it\/compareBranch\/1\.0\.1\/HEAD\n\[1\.0\.1]: https:\/\/github\.com\/_git\/release-it\/release-it\/compareBranch\/1\.0\.0\/1\.0\.1\n\[1\.0\.0]: https:\/\/github\.com\/_git\/release-it\/release-it\/compareBranch\/0\.0\.0\/1\.0\.0\n$/
197
198
  );
198
199
  });
199
200
 
200
201
  test('should add links with custom head to the end of the file', async t => {
201
202
  const options = { [namespace]: { filename: 'CHANGELOG-VERSION_URL_HEAD.md', addVersionUrl: true, head: 'main' } };
202
- const plugin = factory(Plugin, { namespace, options });
203
+ const plugin = await factory(Plugin, { namespace, options });
203
204
  plugin.config.setContext({
204
205
  latestTag: '1.0.0',
205
206
  repo: {
@@ -211,7 +212,7 @@ test('should add links with custom head to the end of the file', async t => {
211
212
  assert.equal(plugin.getChangelog(), '* Item A\n* Item B');
212
213
  assert.match(
213
214
  readFile('./CHANGELOG-VERSION_URL_HEAD.md'),
214
- /^## \[1\.0\.1] - [0-9]{4}-[0-9]{2}-[0-9]{2}\n\n\* Item A\n\* Item B\n\n## \[1\.0\.0] - 2020-05-02\n\n\* Item C\n*\* Item D\n\n\[unreleased]: https:\/\/github\.com\/release-it\/release-it\/compare\/1\.0\.1\.\.\.main\n\[1\.0\.1]: https:\/\/github\.com\/release-it\/release-it\/compare\/1\.0\.0\.\.\.1\.0\.1\n\[1\.0\.0]: https:\/\/github\.com\/release-it\/release-it\/compare\/0\.0\.0\.\.\.1\.0\.0\n$/
215
+ /^## \[1\.0\.1] - [0-9]{4}-[0-9]{2}-[0-9]{2}\n\n\* Item A\n\* Item B\n\n## \[1\.0\.0] - 2020-05-02\n\n\* Item C\n*\* Item D\n\n\[Unreleased]: https:\/\/github\.com\/release-it\/release-it\/compare\/1\.0\.1\.\.\.main\n\[1\.0\.1]: https:\/\/github\.com\/release-it\/release-it\/compare\/1\.0\.0\.\.\.1\.0\.1\n\[1\.0\.0]: https:\/\/github\.com\/release-it\/release-it\/compare\/0\.0\.0\.\.\.1\.0\.0\n$/
215
216
  );
216
217
  });
217
218
 
@@ -219,7 +220,7 @@ test('should add unreleased section and links to the end of the file', async t =
219
220
  const options = {
220
221
  [namespace]: { filename: 'CHANGELOG-VERSION_URL_UNRELEASED.md', addVersionUrl: true, addUnreleased: true }
221
222
  };
222
- const plugin = factory(Plugin, { namespace, options });
223
+ const plugin = await factory(Plugin, { namespace, options });
223
224
  plugin.config.setContext({
224
225
  latestTag: '1.0.0',
225
226
  repo: {
@@ -231,7 +232,7 @@ test('should add unreleased section and links to the end of the file', async t =
231
232
  assert.equal(plugin.getChangelog(), '* Item A\n* Item B');
232
233
  assert.match(
233
234
  readFile('./CHANGELOG-VERSION_URL_UNRELEASED.md'),
234
- /^## \[Unreleased]\n\n## \[1\.0\.1] - [0-9]{4}-[0-9]{2}-[0-9]{2}\n\n\* Item A\n\* Item B\n\n## \[1\.0\.0] - 2020-05-02\n\n\* Item C\n*\* Item D\n\n\[unreleased]: https:\/\/github\.com\/user\/project\/compare\/1\.0\.1\.\.\.HEAD\n\[1\.0\.1]: https:\/\/github\.com\/user\/project\/compare\/1\.0\.0\.\.\.1\.0\.1\n\[1\.0\.0]: https:\/\/github\.com\/user\/project\/compare\/0\.0\.0\.\.\.1\.0\.0\n/
235
+ /^## \[Unreleased]\n\n## \[1\.0\.1] - [0-9]{4}-[0-9]{2}-[0-9]{2}\n\n\* Item A\n\* Item B\n\n## \[1\.0\.0] - 2020-05-02\n\n\* Item C\n*\* Item D\n\n\[Unreleased]: https:\/\/github\.com\/user\/project\/compare\/1\.0\.1\.\.\.HEAD\n\[1\.0\.1]: https:\/\/github\.com\/user\/project\/compare\/1\.0\.0\.\.\.1\.0\.1\n\[1\.0\.0]: https:\/\/github\.com\/user\/project\/compare\/0\.0\.0\.\.\.1\.0\.0\n/
235
236
  );
236
237
  });
237
238
 
@@ -239,7 +240,7 @@ test('should match an existing unreleased link in title case', async t => {
239
240
  const options = {
240
241
  [namespace]: { filename: 'CHANGELOG-VERSION_URL_UNRELEASED_TITLE_CASE.md', addVersionUrl: true, addUnreleased: true }
241
242
  };
242
- const plugin = factory(Plugin, { namespace, options });
243
+ const plugin = await factory(Plugin, { namespace, options });
243
244
  plugin.config.setContext({
244
245
  latestTag: '1.0.0',
245
246
  repo: {
@@ -251,7 +252,7 @@ test('should match an existing unreleased link in title case', async t => {
251
252
  assert.equal(plugin.getChangelog(), '* Item A\n* Item B');
252
253
  assert.match(
253
254
  readFile('./CHANGELOG-VERSION_URL_UNRELEASED_TITLE_CASE.md'),
254
- /^## \[Unreleased]\n\n## \[1\.0\.1] - [0-9]{4}-[0-9]{2}-[0-9]{2}\n\n\* Item A\n\* Item B\n\n## \[1\.0\.0] - 2020-05-02\n\n\* Item C\n*\* Item D\n\n\[unreleased]: https:\/\/github\.com\/user\/project\/compare\/1\.0\.1\.\.\.HEAD\n\[1\.0\.1]: https:\/\/github\.com\/user\/project\/compare\/1\.0\.0\.\.\.1\.0\.1\n\[1\.0\.0]: https:\/\/github\.com\/user\/project\/compare\/0\.0\.0\.\.\.1\.0\.0\n/
255
+ /^## \[Unreleased]\n\n## \[1\.0\.1] - [0-9]{4}-[0-9]{2}-[0-9]{2}\n\n\* Item A\n\* Item B\n\n## \[1\.0\.0] - 2020-05-02\n\n\* Item C\n*\* Item D\n\n\[Unreleased]: https:\/\/github\.com\/user\/project\/compare\/1\.0\.1\.\.\.HEAD\n\[1\.0\.1]: https:\/\/github\.com\/user\/project\/compare\/1\.0\.0\.\.\.1\.0\.1\n\[1\.0\.0]: https:\/\/github\.com\/user\/project\/compare\/0\.0\.0\.\.\.1\.0\.0\n/
255
256
  );
256
257
  });
257
258
 
@@ -259,7 +260,7 @@ test('should add links to the end of a new changelog', async t => {
259
260
  const options = {
260
261
  [namespace]: { filename: 'CHANGELOG-VERSION_URL_NEW.md', addVersionUrl: true, strictLatest: false }
261
262
  };
262
- const plugin = factory(Plugin, { namespace, options });
263
+ const plugin = await factory(Plugin, { namespace, options });
263
264
  sinon.stub(plugin, 'getLatestVersion').returns('0.0.0');
264
265
  plugin.config.setContext({
265
266
  latestTag: undefined,
@@ -273,6 +274,6 @@ test('should add links to the end of a new changelog', async t => {
273
274
  assert.equal(plugin.getChangelog(), '* Item A\n* Item B');
274
275
  assert.match(
275
276
  readFile('./CHANGELOG-VERSION_URL_NEW.md'),
276
- /^## \[1\.0\.0] - [0-9]{4}-[0-9]{2}-[0-9]{2}\n\n\* Item A\n\* Item B\n\n\[unreleased]: https:\/\/github\.com\/user\/project\/compare\/1\.0\.0\.\.\.HEAD\n\[1\.0\.0]: https:\/\/github\.com\/user\/project\/releases\/tag\/1\.0\.0\n$/
277
+ /^## \[1\.0\.0] - [0-9]{4}-[0-9]{2}-[0-9]{2}\n\n\* Item A\n\* Item B\n\n\[Unreleased]: https:\/\/github\.com\/user\/project\/compare\/1\.0\.0\.\.\.HEAD\n\[1\.0\.0]: https:\/\/github\.com\/user\/project\/releases\/tag\/1\.0\.0\n$/
277
278
  );
278
279
  });