1 | "use strict";
|
2 | var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
3 | if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
4 | return cooked;
|
5 | };
|
6 | var __assign = (this && this.__assign) || function () {
|
7 | __assign = Object.assign || function(t) {
|
8 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
9 | s = arguments[i];
|
10 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
11 | t[p] = s[p];
|
12 | }
|
13 | return t;
|
14 | };
|
15 | return __assign.apply(this, arguments);
|
16 | };
|
17 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
18 | return new (P || (P = Promise))(function (resolve, reject) {
|
19 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
20 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
21 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
22 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
23 | });
|
24 | };
|
25 | var __generator = (this && this.__generator) || function (thisArg, body) {
|
26 | var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
27 | return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
28 | function verb(n) { return function (v) { return step([n, v]); }; }
|
29 | function step(op) {
|
30 | if (f) throw new TypeError("Generator is already executing.");
|
31 | while (_) try {
|
32 | if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
33 | if (y = 0, t) op = [op[0] & 2, t.value];
|
34 | switch (op[0]) {
|
35 | case 0: case 1: t = op; break;
|
36 | case 4: _.label++; return { value: op[1], done: false };
|
37 | case 5: _.label++; y = op[1]; op = [0]; continue;
|
38 | case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
39 | default:
|
40 | if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
41 | if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
42 | if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
43 | if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
44 | if (t[2]) _.ops.pop();
|
45 | _.trys.pop(); continue;
|
46 | }
|
47 | op = body.call(thisArg, _);
|
48 | } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
49 | if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
50 | }
|
51 | };
|
52 | var __importDefault = (this && this.__importDefault) || function (mod) {
|
53 | return (mod && mod.__esModule) ? mod : { "default": mod };
|
54 | };
|
55 | var _this = this;
|
56 | Object.defineProperty(exports, "__esModule", { value: true });
|
57 | var dedent_1 = __importDefault(require("dedent"));
|
58 | var changelog_1 = __importDefault(require("../changelog"));
|
59 | var log_parse_1 = __importDefault(require("../log-parse"));
|
60 | var release_1 = require("../release");
|
61 | var logger_1 = require("../utils/logger");
|
62 | var make_commit_from_msg_1 = __importDefault(require("./make-commit-from-msg"));
|
63 | var testOptions = function () { return ({
|
64 | owner: 'foobar',
|
65 | repo: 'auto',
|
66 | baseUrl: 'https://github.custom.com/foobar/auto',
|
67 | labels: release_1.defaultLabelDefinition,
|
68 | baseBranch: 'master'
|
69 | }); };
|
70 | var logParse = new log_parse_1.default();
|
71 | describe('createUserLink', function () {
|
72 | test('should ', function () {
|
73 | var changelog = new changelog_1.default(logger_1.dummyLog(), {
|
74 | owner: '',
|
75 | repo: '',
|
76 | baseUrl: 'https://github.custom.com/',
|
77 | labels: release_1.defaultLabelDefinition,
|
78 | baseBranch: 'master'
|
79 | });
|
80 | changelog.loadDefaultHooks();
|
81 | expect(changelog.createUserLink({
|
82 | name: 'none',
|
83 | email: undefined,
|
84 | username: 'invalid-email-address'
|
85 | }, {
|
86 | hash: '1',
|
87 | labels: [],
|
88 | pullRequest: {
|
89 | number: 22
|
90 | },
|
91 | authorName: 'none',
|
92 | authorEmail: 'default@email.com',
|
93 | authors: [
|
94 | {
|
95 | name: 'none',
|
96 | email: undefined
|
97 | }
|
98 | ],
|
99 | subject: ''
|
100 | })).toBe(undefined);
|
101 | });
|
102 | test('should find email', function () {
|
103 | var changelog = new changelog_1.default(logger_1.dummyLog(), {
|
104 | owner: '',
|
105 | repo: '',
|
106 | baseUrl: 'https://github.custom.com/',
|
107 | labels: release_1.defaultLabelDefinition,
|
108 | baseBranch: 'master'
|
109 | });
|
110 | changelog.loadDefaultHooks();
|
111 | expect(changelog.createUserLink({
|
112 | name: 'none',
|
113 | email: undefined
|
114 | }, {
|
115 | hash: '1',
|
116 | labels: [],
|
117 | pullRequest: {
|
118 | number: 22
|
119 | },
|
120 | authorName: 'none',
|
121 | authorEmail: 'default@email.com',
|
122 | authors: [
|
123 | {
|
124 | name: 'none',
|
125 | email: undefined
|
126 | }
|
127 | ],
|
128 | subject: ''
|
129 | })).toBe('default@email.com');
|
130 | });
|
131 | });
|
132 | describe('Hooks', function () {
|
133 | test('title', function () { return __awaiter(_this, void 0, void 0, function () {
|
134 | var changelog, normalized, _a;
|
135 | return __generator(this, function (_b) {
|
136 | switch (_b.label) {
|
137 | case 0:
|
138 | changelog = new changelog_1.default(logger_1.dummyLog(), testOptions());
|
139 | return [4 , logParse.normalizeCommits([
|
140 | make_commit_from_msg_1.default('Some Feature (#1234)')
|
141 | ])];
|
142 | case 1:
|
143 | normalized = _b.sent();
|
144 | changelog.hooks.renderChangelogTitle.tap('test', function (label, changelogTitles) { return ":heart: " + changelogTitles[label] + " :heart:"; });
|
145 | changelog.loadDefaultHooks();
|
146 | _a = expect;
|
147 | return [4 , changelog.generateReleaseNotes(normalized)];
|
148 | case 2:
|
149 | _a.apply(void 0, [_b.sent()]).toMatchSnapshot();
|
150 | return [2 ];
|
151 | }
|
152 | });
|
153 | }); });
|
154 | test('author', function () { return __awaiter(_this, void 0, void 0, function () {
|
155 | var changelog, normalized, _a;
|
156 | return __generator(this, function (_b) {
|
157 | switch (_b.label) {
|
158 | case 0:
|
159 | changelog = new changelog_1.default(logger_1.dummyLog(), testOptions());
|
160 | return [4 , logParse.normalizeCommits([
|
161 | make_commit_from_msg_1.default('Some Feature (#1234)')
|
162 | ])];
|
163 | case 1:
|
164 | normalized = _b.sent();
|
165 | changelog.hooks.renderChangelogAuthor.tap('test', function (author, commit) { return ":heart: " + author.name + "/" + commit.authorEmail + " :heart:"; });
|
166 | changelog.hooks.renderChangelogAuthorLine.tap('test', function (author, user) { return ":shipit: " + author.name + " (" + user + ")"; });
|
167 | changelog.loadDefaultHooks();
|
168 | _a = expect;
|
169 | return [4 , changelog.generateReleaseNotes(normalized)];
|
170 | case 2:
|
171 | _a.apply(void 0, [_b.sent()]).toMatchSnapshot();
|
172 | return [2 ];
|
173 | }
|
174 | });
|
175 | }); });
|
176 | });
|
177 | describe('generateReleaseNotes', function () {
|
178 | test('should create note for PR commits', function () { return __awaiter(_this, void 0, void 0, function () {
|
179 | var changelog, normalized, _a;
|
180 | return __generator(this, function (_b) {
|
181 | switch (_b.label) {
|
182 | case 0:
|
183 | changelog = new changelog_1.default(logger_1.dummyLog(), testOptions());
|
184 | changelog.loadDefaultHooks();
|
185 | return [4 , logParse.normalizeCommits([
|
186 | make_commit_from_msg_1.default('Some Feature (#1234)', { labels: ['minor'] })
|
187 | ])];
|
188 | case 1:
|
189 | normalized = _b.sent();
|
190 | _a = expect;
|
191 | return [4 , changelog.generateReleaseNotes(normalized)];
|
192 | case 2:
|
193 | _a.apply(void 0, [_b.sent()]).toMatchSnapshot();
|
194 | return [2 ];
|
195 | }
|
196 | });
|
197 | }); });
|
198 | test('should omit authors with invalid email addresses', function () { return __awaiter(_this, void 0, void 0, function () {
|
199 | var changelog, normalized, _a;
|
200 | return __generator(this, function (_b) {
|
201 | switch (_b.label) {
|
202 | case 0:
|
203 | changelog = new changelog_1.default(logger_1.dummyLog(), testOptions());
|
204 | changelog.loadDefaultHooks();
|
205 | return [4 , logParse.normalizeCommits([
|
206 | make_commit_from_msg_1.default('Some Feature (#1234)', { labels: ['minor'] })
|
207 | ])];
|
208 | case 1:
|
209 | normalized = _b.sent();
|
210 | normalized[0].authors[0].username = 'invalid-email-address';
|
211 | _a = expect;
|
212 | return [4 , changelog.generateReleaseNotes(normalized)];
|
213 | case 2:
|
214 | _a.apply(void 0, [_b.sent()]).toMatchSnapshot();
|
215 | return [2 ];
|
216 | }
|
217 | });
|
218 | }); });
|
219 | test('should create note for PR commits without labels', function () { return __awaiter(_this, void 0, void 0, function () {
|
220 | var changelog, normalized, _a;
|
221 | return __generator(this, function (_b) {
|
222 | switch (_b.label) {
|
223 | case 0:
|
224 | changelog = new changelog_1.default(logger_1.dummyLog(), testOptions());
|
225 | changelog.loadDefaultHooks();
|
226 | return [4 , logParse.normalizeCommits([
|
227 | make_commit_from_msg_1.default('Some Feature (#1234)')
|
228 | ])];
|
229 | case 1:
|
230 | normalized = _b.sent();
|
231 | _a = expect;
|
232 | return [4 , changelog.generateReleaseNotes(normalized)];
|
233 | case 2:
|
234 | _a.apply(void 0, [_b.sent()]).toMatchSnapshot();
|
235 | return [2 ];
|
236 | }
|
237 | });
|
238 | }); });
|
239 | test('should use username if present', function () { return __awaiter(_this, void 0, void 0, function () {
|
240 | var changelog, normalized, _a;
|
241 | return __generator(this, function (_b) {
|
242 | switch (_b.label) {
|
243 | case 0:
|
244 | changelog = new changelog_1.default(logger_1.dummyLog(), testOptions());
|
245 | changelog.loadDefaultHooks();
|
246 | return [4 , logParse.normalizeCommits([
|
247 | make_commit_from_msg_1.default('Some Feature (#1234)', {
|
248 | labels: ['minor'],
|
249 | username: 'adam'
|
250 | })
|
251 | ])];
|
252 | case 1:
|
253 | normalized = _b.sent();
|
254 | normalized[0].authors[0].username = 'adam';
|
255 | _a = expect;
|
256 | return [4 , changelog.generateReleaseNotes(normalized)];
|
257 | case 2:
|
258 | _a.apply(void 0, [_b.sent()]).toMatchSnapshot();
|
259 | return [2 ];
|
260 | }
|
261 | });
|
262 | }); });
|
263 | test('should combine pr w/no label and labelled pr', function () { return __awaiter(_this, void 0, void 0, function () {
|
264 | var changelog, normalized, _a;
|
265 | return __generator(this, function (_b) {
|
266 | switch (_b.label) {
|
267 | case 0:
|
268 | changelog = new changelog_1.default(logger_1.dummyLog(), testOptions());
|
269 | changelog.loadDefaultHooks();
|
270 | return [4 , logParse.normalizeCommits([
|
271 | make_commit_from_msg_1.default('Some Feature (#1234)'),
|
272 | make_commit_from_msg_1.default('Third', { labels: ['patch'] })
|
273 | ])];
|
274 | case 1:
|
275 | normalized = _b.sent();
|
276 | _a = expect;
|
277 | return [4 , changelog.generateReleaseNotes(normalized)];
|
278 | case 2:
|
279 | _a.apply(void 0, [_b.sent()]).toMatchSnapshot();
|
280 | return [2 ];
|
281 | }
|
282 | });
|
283 | }); });
|
284 | test("should use only email if author name doesn't exist", function () { return __awaiter(_this, void 0, void 0, function () {
|
285 | var changelog, commits, _a;
|
286 | return __generator(this, function (_b) {
|
287 | switch (_b.label) {
|
288 | case 0:
|
289 | changelog = new changelog_1.default(logger_1.dummyLog(), testOptions());
|
290 | changelog.loadDefaultHooks();
|
291 | return [4 , logParse.normalizeCommits([
|
292 | {
|
293 | hash: 'foo',
|
294 | labels: [],
|
295 | authorEmail: 'adam@dierkens.com',
|
296 | subject: 'Another Feature (#1234)'
|
297 | },
|
298 | {
|
299 | hash: 'foo',
|
300 | labels: [],
|
301 | subject: 'One Feature (#1235)'
|
302 | }
|
303 | ])];
|
304 | case 1:
|
305 | commits = _b.sent();
|
306 | _a = expect;
|
307 | return [4 , changelog.generateReleaseNotes(commits)];
|
308 | case 2:
|
309 | _a.apply(void 0, [_b.sent()]).toMatchSnapshot();
|
310 | return [2 ];
|
311 | }
|
312 | });
|
313 | }); });
|
314 | test('should include PR-less commits as patches', function () { return __awaiter(_this, void 0, void 0, function () {
|
315 | var changelog, commits, _a;
|
316 | return __generator(this, function (_b) {
|
317 | switch (_b.label) {
|
318 | case 0:
|
319 | changelog = new changelog_1.default(logger_1.dummyLog(), testOptions());
|
320 | changelog.loadDefaultHooks();
|
321 | return [4 , logParse.normalizeCommits([
|
322 | {
|
323 | hash: '1',
|
324 | authorName: 'Adam Dierkens',
|
325 | authorEmail: 'adam@dierkens.com',
|
326 | subject: 'I was a push to master\n\n',
|
327 | labels: ['pushToBaseBranch']
|
328 | },
|
329 | {
|
330 | hash: '2',
|
331 | authorName: 'Adam Dierkens',
|
332 | authorEmail: 'adam@dierkens.com',
|
333 | subject: 'First Feature (#1235)',
|
334 | labels: ['minor']
|
335 | }
|
336 | ])];
|
337 | case 1:
|
338 | commits = _b.sent();
|
339 | _a = expect;
|
340 | return [4 , changelog.generateReleaseNotes(commits)];
|
341 | case 2:
|
342 | _a.apply(void 0, [_b.sent()]).toMatchSnapshot();
|
343 | return [2 ];
|
344 | }
|
345 | });
|
346 | }); });
|
347 | test('should order the section major, minor, patch, then the rest', function () { return __awaiter(_this, void 0, void 0, function () {
|
348 | var options, changelog, commits, _a;
|
349 | return __generator(this, function (_b) {
|
350 | switch (_b.label) {
|
351 | case 0:
|
352 | options = testOptions();
|
353 | options.labels = {
|
354 | documentation: options.labels.documentation,
|
355 | internal: options.labels.internal,
|
356 | patch: options.labels.patch,
|
357 | minor: options.labels.minor,
|
358 | major: options.labels.major
|
359 | };
|
360 | changelog = new changelog_1.default(logger_1.dummyLog(), options);
|
361 | changelog.loadDefaultHooks();
|
362 | return [4 , logParse.normalizeCommits([
|
363 | {
|
364 | hash: '0a',
|
365 | authorName: 'Adam Dierkens',
|
366 | authorEmail: 'adam@dierkens.com',
|
367 | subject: 'something\n\n',
|
368 | labels: ['internal']
|
369 | },
|
370 | {
|
371 | hash: '0',
|
372 | authorName: 'Adam Dierkens',
|
373 | authorEmail: 'adam@dierkens.com',
|
374 | subject: 'docs\n\n',
|
375 | labels: ['documentation']
|
376 | },
|
377 | {
|
378 | hash: '1',
|
379 | authorName: 'Adam Dierkens',
|
380 | authorEmail: 'adam@dierkens.com',
|
381 | subject: 'I was a push to master\n\n',
|
382 | labels: ['patch']
|
383 | },
|
384 | {
|
385 | hash: '2',
|
386 | authorName: 'Adam Dierkens',
|
387 | authorEmail: 'adam@dierkens.com',
|
388 | subject: 'First Feature (#1235)',
|
389 | labels: ['minor']
|
390 | },
|
391 | {
|
392 | hash: '2',
|
393 | authorName: 'Adam Dierkens',
|
394 | authorEmail: 'adam@dierkens.com',
|
395 | subject: 'First Feature (#1235)',
|
396 | labels: ['major']
|
397 | }
|
398 | ])];
|
399 | case 1:
|
400 | commits = _b.sent();
|
401 | _a = expect;
|
402 | return [4 , changelog.generateReleaseNotes(commits)];
|
403 | case 2:
|
404 | _a.apply(void 0, [_b.sent()]).toMatchSnapshot();
|
405 | return [2 ];
|
406 | }
|
407 | });
|
408 | }); });
|
409 | test('should be able to customize pushToBaseBranch title', function () { return __awaiter(_this, void 0, void 0, function () {
|
410 | var options, changelog, commits, _a;
|
411 | return __generator(this, function (_b) {
|
412 | switch (_b.label) {
|
413 | case 0:
|
414 | options = testOptions();
|
415 | options.labels = __assign({}, options.labels, { pushToBaseBranch: {
|
416 | name: 'pushToBaseBranch',
|
417 | title: 'Custom Title',
|
418 | description: 'N/A'
|
419 | } });
|
420 | changelog = new changelog_1.default(logger_1.dummyLog(), options);
|
421 | changelog.loadDefaultHooks();
|
422 | return [4 , logParse.normalizeCommits([
|
423 | {
|
424 | hash: '1',
|
425 | authorName: 'Adam Dierkens',
|
426 | authorEmail: 'adam@dierkens.com',
|
427 | subject: 'I was a push to master\n\n',
|
428 | labels: ['pushToBaseBranch']
|
429 | },
|
430 | {
|
431 | hash: '2',
|
432 | authorName: 'Adam Dierkens',
|
433 | authorEmail: 'adam@dierkens.com',
|
434 | subject: 'First Feature (#1235)',
|
435 | labels: ['minor']
|
436 | }
|
437 | ])];
|
438 | case 1:
|
439 | commits = _b.sent();
|
440 | _a = expect;
|
441 | return [4 , changelog.generateReleaseNotes(commits)];
|
442 | case 2:
|
443 | _a.apply(void 0, [_b.sent()]).toMatchSnapshot();
|
444 | return [2 ];
|
445 | }
|
446 | });
|
447 | }); });
|
448 | test('should be able to customize titles', function () { return __awaiter(_this, void 0, void 0, function () {
|
449 | var options, changelog, commits, _a;
|
450 | return __generator(this, function (_b) {
|
451 | switch (_b.label) {
|
452 | case 0:
|
453 | options = testOptions();
|
454 | options.labels = __assign({}, options.labels, { minor: {
|
455 | name: 'Version: Minor',
|
456 | title: 'Woo Woo New Features',
|
457 | description: 'N/A'
|
458 | } });
|
459 | changelog = new changelog_1.default(logger_1.dummyLog(), options);
|
460 | changelog.loadDefaultHooks();
|
461 | return [4 , logParse.normalizeCommits([
|
462 | {
|
463 | hash: '2',
|
464 | authorName: 'Adam Dierkens',
|
465 | authorEmail: 'adam@dierkens.com',
|
466 | subject: 'First Feature (#1235)',
|
467 | labels: ['Version: Minor']
|
468 | }
|
469 | ])];
|
470 | case 1:
|
471 | commits = _b.sent();
|
472 | _a = expect;
|
473 | return [4 , changelog.generateReleaseNotes(commits)];
|
474 | case 2:
|
475 | _a.apply(void 0, [_b.sent()]).toMatchSnapshot();
|
476 | return [2 ];
|
477 | }
|
478 | });
|
479 | }); });
|
480 | test('should add additional release notes', function () { return __awaiter(_this, void 0, void 0, function () {
|
481 | var changelog, commits, _a;
|
482 | return __generator(this, function (_b) {
|
483 | switch (_b.label) {
|
484 | case 0:
|
485 | changelog = new changelog_1.default(logger_1.dummyLog(), testOptions());
|
486 | changelog.loadDefaultHooks();
|
487 | return [4 , logParse.normalizeCommits([
|
488 | {
|
489 | hash: '2',
|
490 | authorName: 'Adam Dierkens',
|
491 | authorEmail: 'adam@dierkens.com',
|
492 | subject: 'First Feature (#1235)',
|
493 | labels: ['minor']
|
494 | }
|
495 | ])];
|
496 | case 1:
|
497 | commits = _b.sent();
|
498 | commits[0].pullRequest.body = dedent_1.default(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n # Why\n\n Some words\n\n ## Release Notes\n\n Here is how you upgrade\n\n ## Todo\n\n - [ ] add tests\n "], ["\n # Why\n\n Some words\n\n ## Release Notes\n\n Here is how you upgrade\n\n ## Todo\n\n - [ ] add tests\n "])));
|
499 | _a = expect;
|
500 | return [4 , changelog.generateReleaseNotes(commits)];
|
501 | case 2:
|
502 | _a.apply(void 0, [_b.sent()]).toMatchSnapshot();
|
503 | return [2 ];
|
504 | }
|
505 | });
|
506 | }); });
|
507 | test('additional release notes should be able to contain sub-headers', function () { return __awaiter(_this, void 0, void 0, function () {
|
508 | var changelog, commits, _a;
|
509 | return __generator(this, function (_b) {
|
510 | switch (_b.label) {
|
511 | case 0:
|
512 | changelog = new changelog_1.default(logger_1.dummyLog(), testOptions());
|
513 | changelog.loadDefaultHooks();
|
514 | return [4 , logParse.normalizeCommits([
|
515 | {
|
516 | hash: '2',
|
517 | authorName: 'Adam Dierkens',
|
518 | authorEmail: 'adam@dierkens.com',
|
519 | subject: 'First Feature (#1235)',
|
520 | labels: ['minor']
|
521 | }
|
522 | ])];
|
523 | case 1:
|
524 | commits = _b.sent();
|
525 | commits[0].pullRequest.body = dedent_1.default(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n # Why\n\n Some words\n\n ## Release Notes\n\n Here is how you upgrade\n\n ### Things you should really know\n\n Bam!?\n\n ## Todo\n\n - [ ] add tests\n "], ["\n # Why\n\n Some words\n\n ## Release Notes\n\n Here is how you upgrade\n\n ### Things you should really know\n\n Bam!?\n\n ## Todo\n\n - [ ] add tests\n "])));
|
526 | _a = expect;
|
527 | return [4 , changelog.generateReleaseNotes(commits)];
|
528 | case 2:
|
529 | _a.apply(void 0, [_b.sent()]).toMatchSnapshot();
|
530 | return [2 ];
|
531 | }
|
532 | });
|
533 | }); });
|
534 | test("doesn't add additional release notes when there are none", function () { return __awaiter(_this, void 0, void 0, function () {
|
535 | var changelog, commits, res;
|
536 | return __generator(this, function (_a) {
|
537 | switch (_a.label) {
|
538 | case 0:
|
539 | changelog = new changelog_1.default(logger_1.dummyLog(), testOptions());
|
540 | changelog.loadDefaultHooks();
|
541 | return [4 , logParse.normalizeCommits([
|
542 | {
|
543 | hash: '2',
|
544 | authorName: 'Adam Dierkens',
|
545 | authorEmail: 'adam@dierkens.com',
|
546 | subject: 'First Feature (#1235)',
|
547 | labels: ['minor']
|
548 | }
|
549 | ])];
|
550 | case 1:
|
551 | commits = _a.sent();
|
552 | commits[0].pullRequest.body = dedent_1.default(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n # Why\n\n Some words\n "], ["\n # Why\n\n Some words\n "])));
|
553 | return [4 , changelog.generateReleaseNotes(commits)];
|
554 | case 2:
|
555 | res = _a.sent();
|
556 | expect(res).toMatchSnapshot();
|
557 | return [2 ];
|
558 | }
|
559 | });
|
560 | }); });
|
561 | test('additional release notes should omit renovate prs', function () { return __awaiter(_this, void 0, void 0, function () {
|
562 | var changelog, commits, _a;
|
563 | return __generator(this, function (_b) {
|
564 | switch (_b.label) {
|
565 | case 0:
|
566 | changelog = new changelog_1.default(logger_1.dummyLog(), testOptions());
|
567 | changelog.loadDefaultHooks();
|
568 | return [4 , logParse.normalizeCommits([
|
569 | {
|
570 | hash: '2',
|
571 | authorName: 'Adam Dierkens',
|
572 | authorEmail: 'adam@dierkens.com',
|
573 | subject: 'First Feature (#1235)',
|
574 | labels: ['minor']
|
575 | }
|
576 | ])];
|
577 | case 1:
|
578 | commits = _b.sent();
|
579 | commits[0].authors[0].username = 'renovate-bot';
|
580 | commits[0].pullRequest.body = dedent_1.default(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n # Why\n\n Some words\n\n ## Release Notes\n\n Here is how you upgrade\n\n ### Things you should really know\n\n Bam!?\n\n ## Todo\n\n - [ ] add tests\n "], ["\n # Why\n\n Some words\n\n ## Release Notes\n\n Here is how you upgrade\n\n ### Things you should really know\n\n Bam!?\n\n ## Todo\n\n - [ ] add tests\n "])));
|
581 | _a = expect;
|
582 | return [4 , changelog.generateReleaseNotes(commits)];
|
583 | case 2:
|
584 | _a.apply(void 0, [_b.sent()]).toMatchSnapshot();
|
585 | return [2 ];
|
586 | }
|
587 | });
|
588 | }); });
|
589 | test('additional release notes should have tappable omit', function () { return __awaiter(_this, void 0, void 0, function () {
|
590 | var changelog, commits, _a;
|
591 | return __generator(this, function (_b) {
|
592 | switch (_b.label) {
|
593 | case 0:
|
594 | changelog = new changelog_1.default(logger_1.dummyLog(), testOptions());
|
595 | changelog.loadDefaultHooks();
|
596 | changelog.hooks.omitReleaseNotes.tap('test', function (commit) {
|
597 | if (commit.labels.includes('no-notes')) {
|
598 | return true;
|
599 | }
|
600 | });
|
601 | return [4 , logParse.normalizeCommits([
|
602 | {
|
603 | hash: '2',
|
604 | authorName: 'Adam Dierkens',
|
605 | authorEmail: 'adam@dierkens.com',
|
606 | subject: 'First Feature (#1235)',
|
607 | labels: ['minor', 'no-notes']
|
608 | }
|
609 | ])];
|
610 | case 1:
|
611 | commits = _b.sent();
|
612 | commits[0].pullRequest.body = dedent_1.default(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n # Why\n\n Some words\n\n ## Release Notes\n\n Here is how you upgrade\n\n ### Things you should really know\n\n Bam!?\n\n ## Todo\n\n - [ ] add tests\n "], ["\n # Why\n\n Some words\n\n ## Release Notes\n\n Here is how you upgrade\n\n ### Things you should really know\n\n Bam!?\n\n ## Todo\n\n - [ ] add tests\n "])));
|
613 | _a = expect;
|
614 | return [4 , changelog.generateReleaseNotes(commits)];
|
615 | case 2:
|
616 | _a.apply(void 0, [_b.sent()]).toMatchSnapshot();
|
617 | return [2 ];
|
618 | }
|
619 | });
|
620 | }); });
|
621 | });
|
622 | var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
|
623 |
|
\ | No newline at end of file |