also looking at this
test(pr-body): set the APP_ENV this file needs instead of inheriting it from another
#1455
1 file
+25
-1
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.
| @@ -1,10 +1,34 @@ | ||
| 1 | 1 | import type { UpdateGroup } from '../src/types' |
| 2 | import { describe, expect, it } from 'bun:test' | |
| 2 | import { afterAll, beforeAll, describe, expect, it } from 'bun:test' | |
| 3 | 3 | import { PullRequestGenerator } from '../src/pr/pr-generator' |
| 4 | 4 | |
| 5 | 5 | describe('PR Body Generation for Major Updates', () => { |
| 6 | 6 | const generator = new PullRequestGenerator() |
| 7 | 7 | |
| 8 | // `ReleaseNotesFetcher.fetchPackageInfo` returns fixed metadata when | |
| 9 | // `APP_ENV` is `test`, which is how the assertions below get a github.com | |
| 10 | // repository URL for stripe without touching the network. | |
| 11 | // | |
| 12 | // This file never set it. It passed only when one of the five other test | |
| 13 | // files that assign `process.env.APP_ENV` happened to run first and leave it | |
| 14 | // set in the shared process, so the result depended on file order: green | |
| 15 | // locally, red in CI, where the run reached the wire and the preload's | |
| 16 | // network guard blocked it. Set the precondition here, and restore it so | |
| 17 | // this file does not do the leaking in turn. | |
| 18 | let previousAppEnv: string | undefined | |
| 19 | ||
| 20 | beforeAll(() => { | |
| 21 | previousAppEnv = process.env.APP_ENV | |
| 22 | process.env.APP_ENV = 'test' | |
| 23 | }) | |
| 24 | ||
| 25 | afterAll(() => { | |
| 26 | if (previousAppEnv === undefined) | |
| 27 | delete process.env.APP_ENV | |
| 28 | else | |
| 29 | process.env.APP_ENV = previousAppEnv | |
| 30 | }) | |
| 31 | ||
| 8 | 32 | describe('single major update issue reproduction', () => { |
| 9 | 33 | it('should generate complete PR body for major stripe update (original issue)', async () => { |
| 10 | 34 | // This test reproduces the exact scenario from the user's issue |