feat: generic per-test scope hooks in itBase#7
Closed
Lojhan wants to merge 19 commits into
Closed
Conversation
a6847d5 to
0c76696
Compare
Owner
Author
|
An usage exaple is here: |
|
This PR has been closed due to inactivity for 15 days. You are welcome to reopen it if you want to continue the development or request it to be reopened by a maintainer 🤝 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces a generic per-test scope lifecycle in Poku so plugin state can be isolated safely, even when tests run concurrently inside the same describe block.
Instead of relying on module-level globals that can leak between tests, Poku now exposes a neutral scope hook contract that any plugin can register and use. Core remains plugin-agnostic.
Why we are building this
Today, tests can already execute concurrently in the same file when multiple it/test calls are registered synchronously.
When plugin internals use shared process-level state (for example module-level Set/Map registries), one test can accidentally mutate or clean up resources owned by another test.
This creates:
We need a first-class per-test state boundary in the runner lifecycle, not only ad-hoc cleanup patterns in each plugin.
What this feature adds
Design goals achieved
What plugins can build from this
With this scope lifecycle, plugins can safely implement per-test resource ownership without global leaks, including:
In short: plugins can now implement reliable per-test state machines that are race-safe by default.
Backward compatibility
Validation
Risks and mitigations
Risk:
Mitigation:
Follow-up work