Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(test): follow nested timer hook execution order
MagicLizi4021bc131f38
diff --git a/scripts/__tests__/check-test-hygiene.test.mjs b/scripts/__tests__/check-test-hygiene.test.mjsindex 951d8b7436..7a1954379a 100644--- a/scripts/__tests__/check-test-hygiene.test.mjs+++ b/scripts/__tests__/check-test-hygiene.test.mjs@@ -50,6 +50,11 @@ test("scanTestSource counts only unjustified hits for each rule", () => {"describe('fake', () => { beforeEach(() => vi.useFakeTimers()); afterEach(() => vi.useRealTimers()); it('one', () => setTimeout(done, 100)); });\ndescribe('real', () => { it('two', () => setTimeout(done, 100)); });",{ realWaits: 1 },],+ [+ "parent beforeEach runs after nested beforeAll",+ "beforeEach(() => vi.useRealTimers()); describe('child', () => { beforeAll(() => vi.useFakeTimers()); it('real', () => setTimeout(done, 100)); });",+ { realWaits: 1 },+ ],["multi-line real wait","await new Promise((resolve) => setTimeout(\n resolve,\n 250,\n));",diff --git a/scripts/check-test-hygiene.mjs b/scripts/check-test-hygiene.mjsindex 41802a229f..67b94cf3af 100644--- a/scripts/check-test-hygiene.mjs+++ b/scripts/check-test-hygiene.mjs@@ -208,7 +208,8 @@ function timerStateAt(index, timerEvents, scopes) {.sort((a, b) => {const depthA = scopes.filter(s => s.kind === 'describe' && s.start < a.scope.start && a.scope.end < s.end).length;const depthB = scopes.filter(s => s.kind === 'describe' && s.start < b.scope.start && b.scope.end < s.end).length;- return depthA - depthB || (a.scope.kind === b.scope.kind ? a.event.index - b.event.index : a.scope.kind === 'beforeAll' ? -1 : 1);+ if (a.scope.kind !== b.scope.kind) return a.scope.kind === 'beforeAll' ? -1 : 1;+ return depthA - depthB || a.event.index - b.event.index;});for (const { event, scope } of hooks) {// An afterEach restoring real timers invalidates beforeAll-only setup