Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests for changelog generation #245

Merged
merged 7 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .ecrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"Exclude": [
".git",
"LICENSE",
"node_modules"
]
}
20 changes: 20 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
root = true
anbraten marked this conversation as resolved.
Show resolved Hide resolved

[*]
indent_style = space
indent_size = 2
tab_width = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
indent_size = 1

[Makefile]
indent_style = tab

[Dockerfile]
indent_style = tab
3 changes: 3 additions & 0 deletions .woodpecker/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ steps:
- corepack enable
- pnpm format:check

editorconfig:
image: woodpeckerci/plugin-editorconfig-checker

when:
- event: pull_request
- event: push
Expand Down
218 changes: 5 additions & 213 deletions src/utils/__snapshots__/change.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`change > 'should add new section' 1`] = `
exports[`change > changelog generation > 'should add new section' 1`] = `
"# Changelog

## [1.0.1](https://github.com/woodpecker-ci/woodpecker/releases/tag/1.0.1) - 2000-02-01
Expand Down Expand Up @@ -51,7 +51,7 @@ exports[`change > 'should add new section' 1`] = `
"
`;

exports[`change > 'should remove previous prerelease versions as soon as the full release is added' 1`] = `
exports[`change > changelog generation > 'should remove previous prerelease ver…' 1`] = `
"# Changelog

## [2.0.1](https://github.com/woodpecker-ci/woodpecker/releases/tag/2.0.1) - 2000-02-01
Expand Down Expand Up @@ -101,57 +101,7 @@ exports[`change > 'should remove previous prerelease versions as soon as the ful
"
`;

exports[`change > 'should remove previous prerelease ver…' 1`] = `
"# Changelog

## [2.0.1](https://github.com/woodpecker-ci/woodpecker/releases/tag/2.0.1) - 2000-02-01

### ❤️ Thanks to all contributors! ❤️

@Alice Wonderland, @John Doe

### 💥 Breaking changes

- Break everything [[#1339](https://github.com/woodpecker-ci/woodpecker/pull/1339)]

### ✨ Features

- Add new feature [[#1338](https://github.com/woodpecker-ci/woodpecker/pull/1338)]

### 🐛 Bug Fixes

- Fix random UI bug [[#1337](https://github.com/woodpecker-ci/woodpecker/pull/1337)]
- Fix another bug ([abc](https://github.com/woodpecker-ci/woodpecker/commit/abc))

### 📈 Enhancement

- Update README ([def](https://github.com/woodpecker-ci/woodpecker/commit/def))

### Misc

- Update README ([def](https://github.com/woodpecker-ci/woodpecker/commit/def))

## [v2.0.0](https://github.com/woodpecker-ci/plugin-git/releases/tag/v2.0.0) - 2022-11-14

- FEATURES
- Partial clone by default (#48)
- BUGFIXES
- Make home var settable (#47)
- ENHANCEMENTS
- Publish semver images (#50)

## [v2.0.0-pre.1](https://github.com/woodpecker-ci/plugin-git/releases/tag/v2.0.0-pre.1) - 2022-11-14

- FEATURES
- Partial clone by default (#48)
- BUGFIXES
- Make home var settable (#47)
- ENHANCEMENTS
- Publish semver images (#50)
"
`;

exports[`change > 'should remove versions newer than the latest released version' 1`] = `
exports[`change > changelog generation > 'should remove versions newer than the…' 1`] = `
"# Changelog

## [2.0.4](https://github.com/woodpecker-ci/woodpecker/releases/tag/2.0.4) - 2000-02-01
Expand Down Expand Up @@ -198,165 +148,7 @@ exports[`change > 'should remove versions newer than the latest released version
"
`;

exports[`change > 'should remove versions newer than the…' 1`] = `
"# Changelog

## [2.0.4](https://github.com/woodpecker-ci/woodpecker/releases/tag/2.0.4) - 2000-02-01

### ❤️ Thanks to all contributors! ❤️

@Alice Wonderland, @John Doe

### 💥 Breaking changes

- Break everything [[#1339](https://github.com/woodpecker-ci/woodpecker/pull/1339)]

### ✨ Features

- Add new feature [[#1338](https://github.com/woodpecker-ci/woodpecker/pull/1338)]

### 🐛 Bug Fixes

- Fix random UI bug [[#1337](https://github.com/woodpecker-ci/woodpecker/pull/1337)]
- Fix another bug ([abc](https://github.com/woodpecker-ci/woodpecker/commit/abc))

### 📈 Enhancement

- Update README ([def](https://github.com/woodpecker-ci/woodpecker/commit/def))

### Misc

- Update README ([def](https://github.com/woodpecker-ci/woodpecker/commit/def))

## [v2.0.1](https://github.com/woodpecker-ci/plugin-git/releases/tag/v2.0.1) - 2022-12-21

- BUGFIXES
- Fix dockerfile to build correct go binary (#54)
- Do not set GIT_TERMINAL_PROMPT=0 for git (#52)

## [v2.0.0](https://github.com/woodpecker-ci/plugin-git/releases/tag/v2.0.0) - 2022-11-14

- FEATURES
- Partial clone by default (#48)
- BUGFIXES
- Make home var settable (#47)
- ENHANCEMENTS
- Publish semver images (#50)
"
`;

exports[`change > 'should update existing changelog section' 1`] = `
"# Changelog

## [2.0.3](https://github.com/woodpecker-ci/woodpecker/releases/tag/2.0.3) - 2000-02-01

### ❤️ Thanks to all contributors! ❤️

@Alice Wonderland, @John Doe

### 💥 Breaking changes

- Break everything [[#1339](https://github.com/woodpecker-ci/woodpecker/pull/1339)]

### ✨ Features

- Add new feature [[#1338](https://github.com/woodpecker-ci/woodpecker/pull/1338)]

### 🐛 Bug Fixes

- Fix random UI bug [[#1337](https://github.com/woodpecker-ci/woodpecker/pull/1337)]
- Fix another bug ([abc](https://github.com/woodpecker-ci/woodpecker/commit/abc))

### 📈 Enhancement

- Update README ([def](https://github.com/woodpecker-ci/woodpecker/commit/def))

### Misc

- Update README ([def](https://github.com/woodpecker-ci/woodpecker/commit/def))

## [v2.0.1](https://github.com/woodpecker-ci/plugin-git/releases/tag/v2.0.1) - 2022-12-21

- BUGFIXES
- Fix dockerfile to build correct go binary (#54)
- Do not set GIT_TERMINAL_PROMPT=0 for git (#52)

## [v2.0.0](https://github.com/woodpecker-ci/plugin-git/releases/tag/v2.0.0) - 2022-11-14

- FEATURES
- Partial clone by default (#48)
- BUGFIXES
- Make home var settable (#47)
- ENHANCEMENTS
- Publish semver images (#50)

## [v1.6.1](https://github.com/woodpecker-ci/plugin-git/releases/tag/v1.6.1) - 2022-11-06

- BUGFIXES
- Explicite set and check for home dir (#46)

## [v1.6.0](https://github.com/woodpecker-ci/plugin-git/releases/tag/v1.6.0) - 2022-10-13

- BUGFIXES
- Handle git-lfs separately (#40)
- ENHANCEMENTS
- if no branch info is set, fallback to default repo branch (#41)

## [v1.5.0](https://github.com/woodpecker-ci/plugin-git/releases/tag/v1.5.0) - 2022-10-06

- ENHANCEMENTS
- Release binarys (#37)
- Use ref to checkout if no commit sha is set (#36)
- Fix tests (#35)
- MISC
- Update urfave/cli to v2.17.1 (#38)
- Use built-in log instead of logrus (#34)

## [v1.4.0](https://github.com/woodpecker-ci/plugin-git/releases/tag/v1.4.0) - 2022-08-30

- ENHANCEMENTS
- Auto enable tags clone if it's ci event is 'tag' (#30)
- Support more architectures (#29)

## [v1.3.0](https://github.com/woodpecker-ci/plugin-git/releases/tag/v1.3.0) - 2022-08-15

- FEATURES
- Add option to Change branch name for checkout (#28)

## [v1.2.0](https://github.com/woodpecker-ci/plugin-git/releases/tag/v1.2.0) - 2022-05-25

- FEATURES
- Add git-lfs (#21)
- Custom ssl certs for git (#19)
- ENHANCEMENTS
- Add an \`lfs\` setting which lets you disable Git LFS (#24)
- DOCUMENTATION
- Add docs page (#23)

## [v1.1.2](https://github.com/woodpecker-ci/plugin-git/releases/tag/v1.1.2) - 2022-01-30

- BUGFIXES
- Fix empty login/password in netrc (#20)

## [v1.1.1](https://github.com/woodpecker-ci/plugin-git/releases/tag/v1.1.1) - 2021-12-23

- BUGFIXES
- Fix version info (#13)

## [v1.1.0](https://github.com/woodpecker-ci/plugin-git/releases/tag/v1.1.0) - 2021-12-18

- FEATURES
- Add ppc64le support (#8)
- BUGFIXES
- Regognize \`CI_*\` EnvVars (#6)
- ENHANCEMENTS
- Multiarch build (#8)
- MISC
- Upgrade urfave/cli to v2 (#5)
"
`;

exports[`change > 'should update existing changelog sect…' 1`] = `
exports[`change > changelog generation > 'should update existing changelog sect…' 1`] = `
"# Changelog

## [2.0.3](https://github.com/woodpecker-ci/woodpecker/releases/tag/2.0.3) - 2000-02-01
Expand Down Expand Up @@ -467,7 +259,7 @@ exports[`change > 'should update existing changelog sect…' 1`] = `
"
`;

exports[`change > should generate a changelog 1`] = `
exports[`change > changelog generation > should generate a changelog section 1`] = `
"## [1.0.0](https://github.com/woodpecker-ci/woodpecker/releases/tag/v1.0.0) - 2000-02-01

### ❤️ Thanks to all contributors! ❤️
Expand Down
Loading