also looking at this
fix: validate complete workspace release before tagging
#365
5 files
+73
-33
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.
| @@ -188,3 +188,26 @@ test('the published release tool restores all workspace and native versions on a | ||
| 188 | 188 | expect(git('status', '--porcelain')).toBe('') |
| 189 | 189 | }) |
| 190 | 190 | }) |
| 191 | ||
| 192 | test('pending validation rejects an incomplete workspace before a tag or commit exists', () => { | |
| 193 | fixture((directory, git) => { | |
| 194 | const paths = nativeWorkspace(directory, git) | |
| 195 | mkdirSync(join(directory, 'scripts')) | |
| 196 | writeFileSync(join(directory, 'scripts/release-version.ts'), readFileSync(join(import.meta.dir, 'release-version.ts'))) | |
| 197 | git('add', 'scripts') | |
| 198 | git('commit', '-qm', 'chore: install actual release validator') | |
| 199 | const head = git('rev-parse', 'HEAD') | |
| 200 | const before = paths.map(path => readFileSync(join(directory, path), 'utf8')) | |
| 201 | const bumpx = Bun.resolveSync('@stacksjs/bumpx/bin/cli.js', import.meta.dir) | |
| 202 | const result = Bun.spawnSync([ | |
| 203 | process.execPath, bumpx, '1.0.2', '--files', 'package.json', '--commit', '--tag', '--no-push', '--yes', '--no-changelog', | |
| 204 | '--execute', `${shellQuote(process.execPath)} scripts/release-version.ts --pending`, | |
| 205 | ], { cwd: directory, stdout: 'pipe', stderr: 'pipe', timeout: 30_000 }) | |
| 206 | expect(result.exitCode).not.toBe(0) | |
| 207 | expect(`${result.stdout.toString()}${result.stderr.toString()}`).toContain('packages/sdk/package.json') | |
| 208 | expect(paths.map(path => readFileSync(join(directory, path), 'utf8'))).toEqual(before) | |
| 209 | expect(git('rev-parse', 'HEAD')).toBe(head) | |
| 210 | expect(git('tag', '--list', 'v1.0.2')).toBe('') | |
| 211 | expect(git('status', '--porcelain')).toBe('') | |
| 212 | }) | |
| 213 | }) | |