Skip to content

Test afterAll lifecycle and --ci completion#171

Closed
DmitrySharabin wants to merge 2 commits into
fix/168-afterall-completionfrom
test/168-afterall-completion
Closed

Test afterAll lifecycle and --ci completion#171
DmitrySharabin wants to merge 2 commits into
fix/168-afterall-completionfrom
test/168-afterall-completion

Conversation

@DmitrySharabin

@DmitrySharabin DmitrySharabin commented Jun 23, 2026

Copy link
Copy Markdown
Member

Stacks on #170.

Two-layer regression coverage for #168:

  • Unit (Runs at every level, bottom-up, before result.finished resolves) — pins the TestResult finish-listener contract. 3-level nested afterAll with mixed sync/async; asserts bottom-up push order.
  • E2E (Completes before process.exit in --ci mode (issue #168)) — spawns node bin/htest.js fixture.js --ci in a subprocess; the fixture's async afterAll writes [test] afterAll ran to stderr, captured and asserted on. Catches env-layer regressions the unit test can't.

Verified by reverting each fix in isolation:

  • Revert TestResult.js → unit fails (Got ["level1", "root"], expected ["level2", "level1", "root"]).
  • Revert env/node.js → e2e fails (Got false, expected true); unit still passes (independent coverage confirmed).

Test plan

  • CI passes

@DmitrySharabin
DmitrySharabin force-pushed the fix/168-afterall-completion branch from ae53957 to e7128eb Compare June 25, 2026 12:58
@DmitrySharabin
DmitrySharabin force-pushed the test/168-afterall-completion branch from e355018 to 84252f8 Compare June 25, 2026 12:58
@DmitrySharabin
DmitrySharabin force-pushed the fix/168-afterall-completion branch from e7128eb to e02c79f Compare June 26, 2026 14:59
@DmitrySharabin

Copy link
Copy Markdown
Member Author

Folded into #170, which now contains the fix, these tests, and the docs from #172 as a single squashed commit. The reworked fix dispatches finish after afterAll (matching Mocha/Vitest/Jest convention) — the lifecycle tests here still pass against the new approach.

Closing.

@DmitrySharabin
DmitrySharabin deleted the test/168-afterall-completion branch June 26, 2026 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant