aws / aws/agentcore-cli

src/io/watchFile.test.ts flaky test on refactor branch.

Offen Anfängerfreundlich
#2,140 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
TypeScript
Sterne
290
Forks
96
Ø Merge
1 T. 2 Std.
Gemergte PRs (30 T.)
183

Beschreibung

```
src/io/watchFile.test.ts:
24 | watchFile(path, () => calls++, controller.signal);
25 |
26 | writeFileSync(path, '{"a":1}');
27 | writeFileSync(path, '{"a":2}');
28 | await Bun.sleep(250);
29 | expect(calls).toBe(1);
^
error: expect(received).toBe(expected)

Expected: 1
Received: 0

at (/Users/runner/work/agentcore-cli/agentcore-cli/src/io/watchFile.test.ts:29:17)

Error: Expected: 1
Received: 0

at (/Users/runner/work/agentcore-cli/agentcore-cli/src/io/watchFile.test.ts:29:17)
(fail) debounces a burst of edits into a single callback and stops on abort [257.78ms]
(pass) a missing file fails quietly rather than throwing [0.18ms]
```
Ex. https://github.com/aws/agentcore-cli/actions/runs/33117797255/job/98676836925

Seen it fail twice on MacOS, retrying fixed.

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Start with the failing test in src/io/watchFile.test.ts, especially the debounced callback and abort case around line 29, and reproduce the failure on macOS if possible. Check why the two writeFileSync calls can leave calls at 0 after the 250ms wait. Done means the test reliably observes one callback for the edit burst and still verifies that abort stops watching.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
bun, typescript
Bereich
testing-qa
Issue-Typ
Bug
Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Aktivitätsstatus
Aktiv
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
72/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.