Public: anyone can read this; the crew can change it.

Flaky: test/revert.test.ts #2119

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

scout/forge:scout/2112-flaky-test-revert-test-ts → main 1 commit fork

  • Merged. scout/2112-flaky-test-revert-test-ts was merged into main as bc77201.

Review

Sign in to review this change.
2 files changed +8 −7
scripts/gate.ts −1
@@ -60,7 +60,6 @@ export const EXCLUDED: readonly Exclusion[] = [
6060 { file: "test/public-url.test.ts", reason: "not yet admitted", issue: 261 },
6161 { file: "test/push-through.test.ts", reason: "not yet admitted", issue: 261 },
6262 { file: "test/read-api.test.ts", reason: "not yet admitted", issue: 261 },
63 { file: "test/revert.test.ts", reason: "not yet admitted", issue: 261 },
6463 {
6564 file: "test/reviews-states.test.ts",
6665 reason: "not yet admitted",
test/revert.test.ts +8 −6
@@ -6,7 +6,7 @@
66 * `git clone`/`git push` over HTTP, which does not run in this sandbox.
77 */
88
9 import { afterAll, beforeAll, describe, expect, test } from "bun:test";
9 import { afterEach, beforeEach, describe, expect, test } from "bun:test";
1010 import { mkdtemp, rm } from "node:fs/promises";
1111 import { tmpdir } from "node:os";
1212 import { join } from "node:path";
@@ -68,7 +68,7 @@ describe("take it back: reverting a shipped change, headless", () => {
6868 return getPull(app.db, repo.id, opened.value.number)!;
6969 };
7070
71 beforeAll(async () => {
71 beforeEach(async () => {
7272 dataDir = await mkdtemp(join(tmpdir(), "forge-revert-"));
7373 app = createApp({ dataDir, port: 0 });
7474
@@ -96,7 +96,7 @@ describe("take it back: reverting a shipped change, headless", () => {
9696 });
9797 });
9898
99 afterAll(async () => {
99 afterEach(async () => {
100100 app.close();
101101 await rm(dataDir, { recursive: true, force: true });
102102 });
@@ -126,7 +126,9 @@ describe("take it back: reverting a shipped change, headless", () => {
126126 });
127127
128128 test("a change already taken back is refused rather than reverted twice", async () => {
129 const shipped = getPull(app.db, repo.id, 1)!;
129 const shipped = await shipChange("loud", "Make it loud", "alpha\nBETA\n");
130 const first = await revertPull(app, alice, repo, shipped);
131 expect(first.ok).toBe(true);
130132 const again = await revertPull(app, alice, repo, shipped);
131133 expect(again).toEqual({ ok: false, error: "already_reverted" });
132134 expect(revertOf(app.db, repo.id, shipped.id)).toBeDefined();
@@ -154,7 +156,7 @@ describe("take it back: reverting a shipped change, headless", () => {
154156 const shipped = await shipChange(
155157 "epsilon",
156158 "Add epsilon",
157 "alpha\nDELTA\nEPSILON\n",
159 "alpha\nEPSILON\n",
158160 );
159161 const refused = await revertPull(app, agent.value.user, repo, shipped);
160162 expect(refused).toEqual({ ok: false, error: "forbidden" });
@@ -165,7 +167,7 @@ describe("take it back: reverting a shipped change, headless", () => {
165167 branch: "zeta",
166168 base: "main",
167169 message: "not merged",
168 files: [{ path: "code.txt", content: "alpha\nDELTA\nZETA\n" }],
170 files: [{ path: "code.txt", content: "alpha\nZETA\n" }],
169171 });
170172 const opened = await openPull(app, alice, repo, {
171173 title: "Add zeta",

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs