Merged
Conversation
When repterm is installed as an npm dependency, the "bun" export condition causes CLI (from dist/) and user test code (from src/) to use different TestRegistry instances, resulting in "beforeAll must be called inside a describe() block" errors. Removing the "bun" condition ensures both resolve to the same dist/ module. This follows the Playwright pattern and is the standard approach for CLI tools. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Without the "bun" export condition, workspace packages resolve to dist/ instead of src/. The test job needs to build packages first so dist/ exists when tests import from workspace dependencies like repterm-api. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
🎉 This PR is included in version 0.2.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.
Problem
When repterm is installed as an npm dependency and users run
bun run repterm --record .with asetup.tsfile containingbeforeAll(), the CLI fails with:beforeAll must be called inside a describe() blockThis is caused by the dual-module-instance hazard: the
"bun": "./src/index.ts"export condition causes the CLI (running fromdist/cli/index.js) and user code imports to resolve to different module instances, each with their ownTestRegistrysingleton.Solution
Remove the
"bun"export condition from all packages, ensuring both CLI and user code always resolve to the samedist/module. This follows the proven pattern used by Playwright and other major test frameworks, eliminating the problem at its source.Changes
"bun": "./src/index.ts"from exports inpackages/repterm,packages/plugin-api, andpackages/plugin-kubectl"src"from files array (no longer needed since bun condition is gone)All 290 tests pass without modification.