-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Philipp Kief <[email protected]> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Pooya Parsa <[email protected]>
- Loading branch information
1 parent
8c354da
commit 46cd50c
Showing
6 changed files
with
138 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import { describe, expect, test } from "vitest"; | ||
import { loadChangelogConfig, generateMarkDown } from "../src"; | ||
import { testCommits } from "./fixtures/commits"; | ||
|
||
describe("contributors", () => { | ||
test("should include authors", async () => { | ||
const config = await loadChangelogConfig(process.cwd(), { | ||
newVersion: "1.0.0", | ||
}); | ||
const contents = await generateMarkDown(testCommits, config); | ||
|
||
expect(contents).toMatchInlineSnapshot(` | ||
"## v1.0.0 | ||
[compare changes](https://github.com/unjs/changelogen/compare/v0.5.7...v1.0.0) | ||
### 🚀 Enhancements | ||
- **scope:** Add feature | ||
### 🩹 Fixes | ||
- **scope:** Resolve bug | ||
### 📖 Documentation | ||
- **scope:** Update documentation | ||
### 🏡 Chore | ||
- **scope:** Update dependencies | ||
### ❤️ Contributors | ||
- John Doe ([@brainsucker](https://github.com/brainsucker)) | ||
- Jane Smith <[email protected]> | ||
- Alice Johnson <[email protected]> | ||
- Bob Williams <[email protected]>" | ||
`); | ||
}); | ||
|
||
test("should skip authors with noAuthors config", async () => { | ||
const config = await loadChangelogConfig(process.cwd(), { | ||
newVersion: "1.0.0", | ||
noAuthors: true, | ||
}); | ||
const contents = await generateMarkDown(testCommits, config); | ||
|
||
expect(contents).toMatchInlineSnapshot(` | ||
"## v1.0.0 | ||
[compare changes](https://github.com/unjs/changelogen/compare/v0.5.7...v1.0.0) | ||
### 🚀 Enhancements | ||
- **scope:** Add feature | ||
### 🩹 Fixes | ||
- **scope:** Resolve bug | ||
### 📖 Documentation | ||
- **scope:** Update documentation | ||
### 🏡 Chore | ||
- **scope:** Update dependencies" | ||
`); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
export const testCommits = [ | ||
{ | ||
author: { | ||
name: "John Doe", | ||
email: "[email protected]", | ||
}, | ||
message: "feat: add feature", | ||
shortHash: "1234", | ||
body: "body", | ||
type: "feat", | ||
description: "add feature", | ||
scope: "scope", | ||
references: [], | ||
authors: [], | ||
isBreaking: false, | ||
}, | ||
{ | ||
author: { | ||
name: "Jane Smith", | ||
email: "[email protected]", | ||
}, | ||
message: "fix: resolve bug", | ||
shortHash: "5678", | ||
body: "body", | ||
type: "fix", | ||
description: "resolve bug", | ||
scope: "scope", | ||
references: [], | ||
authors: [], | ||
isBreaking: false, | ||
}, | ||
{ | ||
author: { | ||
name: "Alice Johnson", | ||
email: "[email protected]", | ||
}, | ||
message: "chore: update dependencies", | ||
shortHash: "9012", | ||
body: "body", | ||
type: "chore", | ||
description: "update dependencies", | ||
scope: "scope", | ||
references: [], | ||
authors: [], | ||
isBreaking: false, | ||
}, | ||
{ | ||
author: { | ||
name: "Bob Williams", | ||
email: "[email protected]", | ||
}, | ||
message: "docs: update documentation", | ||
shortHash: "3456", | ||
body: "body", | ||
type: "docs", | ||
description: "update documentation", | ||
scope: "scope", | ||
references: [], | ||
authors: [], | ||
isBreaking: false, | ||
}, | ||
]; |