feat(releaser): release v1.5.0 — Node.js, multi-module Maven, configurable bump rules
ci / vet, staticcheck, test, build (push) Failing after 4m11s
release / Build and publish release (push) Successful in 5m7s

- Add internal/node package: reads/writes package.json version (single or
  multi-path via node.package_json / node.package_jsons)
- Add maven.pom_paths support: update multiple pom.xml files in one release
  commit; pom_paths overrides pom_path; --pom flag clears pom_paths
- Add git.bump_rules config: per-type control of which version component bumps
  (breaking/feat/fix accept "patch" or "minor"); wired through version.Next()
  as a new sixth parameter
- Extract injectable function vars (absPath, gitAllCommits, gitCommitsSince,
  gitCommitFiles) to enable error-path testing without interfaces
- Achieve 100% per-package statement coverage across all 12 packages

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-07-11 16:59:28 +02:00
parent 5af107b06d
commit f07220b0c6
17 changed files with 1759 additions and 77 deletions
+40
View File
@@ -99,6 +99,28 @@ func TestUpdateBreakingSection(t *testing.T) {
}
}
func TestUpdateExistingFileNoHeading(t *testing.T) {
dir := t.TempDir()
path := filepath.Join(dir, "CHANGELOG.md")
// File with content but no ## [ heading — new section appended at bottom.
os.WriteFile(path, []byte("# Changelog\n\nSome preamble.\n"), 0644)
err := Update(path, "v1.0.0", "1.0.0", []string{"fix: something"})
if err != nil {
t.Fatal(err)
}
data, _ := os.ReadFile(path)
s := string(data)
if !strings.Contains(s, "## [1.0.0]") {
t.Error("expected version header appended")
}
if !strings.Contains(s, "# Changelog") {
t.Error("expected original content preserved")
}
}
func TestUpdateReadError(t *testing.T) {
dir := t.TempDir()
// Create a directory where the file should be — ReadFile will error.
@@ -109,3 +131,21 @@ func TestUpdateReadError(t *testing.T) {
t.Error("expected error when path is a directory")
}
}
func TestUpdateIdempotent(t *testing.T) {
dir := t.TempDir()
path := filepath.Join(dir, "CHANGELOG.md")
// Pre-seed with the version heading already present.
os.WriteFile(path, []byte("# Changelog\n\n## [1.0.0] - 2026-01-01\n\n- fix: something\n"), 0644)
// Second call must be a no-op (returns nil, file unchanged).
if err := Update(path, "v1.0.0", "1.0.0", []string{"fix: something"}); err != nil {
t.Fatalf("idempotent Update should not error, got: %v", err)
}
data, _ := os.ReadFile(path)
if strings.Count(string(data), "## [1.0.0]") != 1 {
t.Error("version heading should appear exactly once after idempotent call")
}
}