ReviewOS

also looking at this

craft-native/craft

test: use consistent budgets for real changelog commands

#367
Merged chris wants to merge codex/native-changelog-command-budgets into main
1 file +8 -7

Review threads live on the whole diff, not on one commit, so none are shown here - a thread's line means something in the branch's final form, and painting it into an intermediate step would put it on code it is not about.

scripts/changelog-preview.test.tsmodified+8-7
Changes to scripts/changelog-preview.test.ts
@@ -34,6 +34,7 @@ function fixture(run: (directory: string, git: (...args: string[]) => string) =>
3434 finally { rmSync(directory, { recursive: true, force: true }) }
3535}
3636
37// Real Git/Logsmith fixtures use the release CLI rehearsals' bounded budget.
3738test('real generator preview preserves a clean checkout and tracked changelog', () => {
3839 fixture((directory, git) => {
3940 const before = readFileSync(join(directory, 'CHANGELOG.md'), 'utf8')
@@ -42,7 +43,7 @@ test('real generator preview preserves a clean checkout and tracked changelog',
4243 expect(readFileSync(join(directory, 'CHANGELOG.md'), 'utf8')).toBe(before)
4344 expect(git('status', '--porcelain')).toBe('')
4445 })
45})
46}, 30_000)
4647
4748test('CLI emits only the preview and preserves pre-existing local edits', () => {
4849 fixture((directory, git) => {
@@ -56,7 +57,7 @@ test('CLI emits only the preview and preserves pre-existing local edits', () =>
5657 expect(readFileSync(join(directory, 'CHANGELOG.md'), 'utf8')).toBe(notes)
5758 expect(git('status', '--porcelain')).toBe(before)
5859 })
59})
60}, 30_000)
6061
6162test('rejects output overrides and invalid refs without mutating the repository', () => {
6263 fixture((directory, git) => {
@@ -67,7 +68,7 @@ test('rejects output overrides and invalid refs without mutating the repository'
6768 expect(git('status', '--porcelain')).toBe('')
6869 }
6970 })
70})
71}, 30_000)
7172
7273test('keeps one link per issue or pull request without dropping distinct references', () => {
7374 const first = '[#326](https://github.com/craft-native/craft/issues/326)'
@@ -85,7 +86,7 @@ test('real merge commit preview has only one linked reference', () => {
8586 expect(output.match(/\[#326\]\(https:\/\/github\.com\/example\/fixture\/issues\/326\)/g)).toHaveLength(1)
8687 expect(git('status', '--porcelain')).toBe('')
8788 })
88})
89}, 30_000)
8990
9091test('release generation prepends a deduplicated section with the future tag', () => {
9192 fixture((directory, git) => {
@@ -98,7 +99,7 @@ test('release generation prepends a deduplicated section with the future tag', (
9899 expect(git('status', '--porcelain')).toBe(' M CHANGELOG.md\n')
99100 expect(() => generateReleaseChangelog(directory)).toThrow('already in the changelog')
100101 })
101})
102}, 30_000)
102103
103104test('failed release generation leaves the changelog unchanged', () => {
104105 fixture((directory, git) => {
@@ -108,7 +109,7 @@ test('failed release generation leaves the changelog unchanged', () => {
108109 expect(readFileSync(join(directory, 'CHANGELOG.md'), 'utf8')).toBe(changelog)
109110 expect(git('status', '--porcelain')).toBe(' M package.json\n')
110111 })
111})
112}, 30_000)
112113
113114test('release notes can include changes since the last published release after an abandoned tag', () => {
114115 fixture((directory, git) => {
@@ -120,7 +121,7 @@ test('release notes can include changes since the last published release after a
120121 expect(content).toContain('/compare/v1.0.0...v1.0.2)')
121122 expect(git('tag', '--list', 'v1.0.1')).toBe('v1.0.1\n')
122123 })
123})
124}, 30_000)
124125
125126test('patch release uses the guarded changelog generator before committing', () => {
126127 const project = JSON.parse(readFileSync(join(import.meta.dir, '..', 'package.json'), 'utf8'))