also looking at this
test: use consistent budgets for real changelog commands
#367
1 file
+8
-7
| @@ -34,6 +34,7 @@ function fixture(run: (directory: string, git: (...args: string[]) => string) => | ||
| 34 | 34 | finally { rmSync(directory, { recursive: true, force: true }) } |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | // Real Git/Logsmith fixtures use the release CLI rehearsals' bounded budget. | |
| 37 | 38 | test('real generator preview preserves a clean checkout and tracked changelog', () => { |
| 38 | 39 | fixture((directory, git) => { |
| 39 | 40 | const before = readFileSync(join(directory, 'CHANGELOG.md'), 'utf8') |
| @@ -42,7 +43,7 @@ test('real generator preview preserves a clean checkout and tracked changelog', | ||
| 42 | 43 | expect(readFileSync(join(directory, 'CHANGELOG.md'), 'utf8')).toBe(before) |
| 43 | 44 | expect(git('status', '--porcelain')).toBe('') |
| 44 | 45 | }) |
| 45 | }) | |
| 46 | }, 30_000) | |
| 46 | 47 | |
| 47 | 48 | test('CLI emits only the preview and preserves pre-existing local edits', () => { |
| 48 | 49 | fixture((directory, git) => { |
| @@ -56,7 +57,7 @@ test('CLI emits only the preview and preserves pre-existing local edits', () => | ||
| 56 | 57 | expect(readFileSync(join(directory, 'CHANGELOG.md'), 'utf8')).toBe(notes) |
| 57 | 58 | expect(git('status', '--porcelain')).toBe(before) |
| 58 | 59 | }) |
| 59 | }) | |
| 60 | }, 30_000) | |
| 60 | 61 | |
| 61 | 62 | test('rejects output overrides and invalid refs without mutating the repository', () => { |
| 62 | 63 | fixture((directory, git) => { |
| @@ -67,7 +68,7 @@ test('rejects output overrides and invalid refs without mutating the repository' | ||
| 67 | 68 | expect(git('status', '--porcelain')).toBe('') |
| 68 | 69 | } |
| 69 | 70 | }) |
| 70 | }) | |
| 71 | }, 30_000) | |
| 71 | 72 | |
| 72 | 73 | test('keeps one link per issue or pull request without dropping distinct references', () => { |
| 73 | 74 | 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', () => { | ||
| 85 | 86 | expect(output.match(/\[#326\]\(https:\/\/github\.com\/example\/fixture\/issues\/326\)/g)).toHaveLength(1) |
| 86 | 87 | expect(git('status', '--porcelain')).toBe('') |
| 87 | 88 | }) |
| 88 | }) | |
| 89 | }, 30_000) | |
| 89 | 90 | |
| 90 | 91 | test('release generation prepends a deduplicated section with the future tag', () => { |
| 91 | 92 | fixture((directory, git) => { |
| @@ -98,7 +99,7 @@ test('release generation prepends a deduplicated section with the future tag', ( | ||
| 98 | 99 | expect(git('status', '--porcelain')).toBe(' M CHANGELOG.md\n') |
| 99 | 100 | expect(() => generateReleaseChangelog(directory)).toThrow('already in the changelog') |
| 100 | 101 | }) |
| 101 | }) | |
| 102 | }, 30_000) | |
| 102 | 103 | |
| 103 | 104 | test('failed release generation leaves the changelog unchanged', () => { |
| 104 | 105 | fixture((directory, git) => { |
| @@ -108,7 +109,7 @@ test('failed release generation leaves the changelog unchanged', () => { | ||
| 108 | 109 | expect(readFileSync(join(directory, 'CHANGELOG.md'), 'utf8')).toBe(changelog) |
| 109 | 110 | expect(git('status', '--porcelain')).toBe(' M package.json\n') |
| 110 | 111 | }) |
| 111 | }) | |
| 112 | }, 30_000) | |
| 112 | 113 | |
| 113 | 114 | test('release notes can include changes since the last published release after an abandoned tag', () => { |
| 114 | 115 | fixture((directory, git) => { |
| @@ -120,7 +121,7 @@ test('release notes can include changes since the last published release after a | ||
| 120 | 121 | expect(content).toContain('/compare/v1.0.0...v1.0.2)') |
| 121 | 122 | expect(git('tag', '--list', 'v1.0.1')).toBe('v1.0.1\n') |
| 122 | 123 | }) |
| 123 | }) | |
| 124 | }, 30_000) | |
| 124 | 125 | |
| 125 | 126 | test('patch release uses the guarded changelog generator before committing', () => { |
| 126 | 127 | const project = JSON.parse(readFileSync(join(import.meta.dir, '..', 'package.json'), 'utf8')) |