Loading homepage
Input: const r = new TestRunner(); r.beforeEach(() => log.push("root setup")); r.describe("inner", s => { s.beforeEach(() => log.push("inner setup")); s.afterEach(() => log.push("inner cleanup")); s.test("works", () => log.push("test")); }); r.afterEach(() => log.push("root cleanup")); await r.run(); Output: root setup, inner setup, test, inner cleanup, root cleanup
Input: r.beforeEach(() => { throw "setup failed"; }); await r.run(); Output: Test bodies are skipped, every applicable cleanup hook still runs, and each affected test reports setup failed.
Implement the exported API in index.js or index.ts. The documented contract defines the scope of this exercise.