|
| 1 | +import { describe, expect, test } from "vitest"; |
| 2 | +import { loadChangelogConfig, generateMarkDown } from "../src"; |
| 3 | +import { testCommits } from "./fixtures/commits"; |
| 4 | + |
| 5 | +describe("contributors", () => { |
| 6 | + test("should include authors", async () => { |
| 7 | + const config = await loadChangelogConfig(process.cwd(), { |
| 8 | + newVersion: "1.0.0", |
| 9 | + }); |
| 10 | + const contents = await generateMarkDown(testCommits, config); |
| 11 | + |
| 12 | + expect(contents).toMatchInlineSnapshot(` |
| 13 | + "## v1.0.0 |
| 14 | +
|
| 15 | + [compare changes](https://github.com/unjs/changelogen/compare/v0.5.7...v1.0.0) |
| 16 | +
|
| 17 | + ### 🚀 Enhancements |
| 18 | +
|
| 19 | + - **scope:** Add feature |
| 20 | +
|
| 21 | + ### 🩹 Fixes |
| 22 | +
|
| 23 | + - **scope:** Resolve bug |
| 24 | +
|
| 25 | + ### 📖 Documentation |
| 26 | +
|
| 27 | + - **scope:** Update documentation |
| 28 | +
|
| 29 | + ### 🏡 Chore |
| 30 | +
|
| 31 | + - **scope:** Update dependencies |
| 32 | +
|
| 33 | + ### ❤️ Contributors |
| 34 | +
|
| 35 | + - John Doe ([@brainsucker](https://github.com/brainsucker)) |
| 36 | + - Jane Smith <jane@smith.com> |
| 37 | + - Alice Johnson <alice@johnson.com> |
| 38 | + - Bob Williams <bob@williams.com>" |
| 39 | + `); |
| 40 | + }); |
| 41 | + |
| 42 | + test("should skip authors with noAuthors config", async () => { |
| 43 | + const config = await loadChangelogConfig(process.cwd(), { |
| 44 | + newVersion: "1.0.0", |
| 45 | + noAuthors: true, |
| 46 | + }); |
| 47 | + const contents = await generateMarkDown(testCommits, config); |
| 48 | + |
| 49 | + expect(contents).toMatchInlineSnapshot(` |
| 50 | + "## v1.0.0 |
| 51 | +
|
| 52 | + [compare changes](https://github.com/unjs/changelogen/compare/v0.5.7...v1.0.0) |
| 53 | +
|
| 54 | + ### 🚀 Enhancements |
| 55 | +
|
| 56 | + - **scope:** Add feature |
| 57 | +
|
| 58 | + ### 🩹 Fixes |
| 59 | +
|
| 60 | + - **scope:** Resolve bug |
| 61 | +
|
| 62 | + ### 📖 Documentation |
| 63 | +
|
| 64 | + - **scope:** Update documentation |
| 65 | +
|
| 66 | + ### 🏡 Chore |
| 67 | +
|
| 68 | + - **scope:** Update dependencies" |
| 69 | + `); |
| 70 | + }); |
| 71 | +}); |
0 commit comments