Get types to work inside of a realm test file locally#4181
Get types to work inside of a realm test file locally#4181tintinthong wants to merge 4 commits intomainfrom
Conversation
9832184 to
c2aff15
Compare
Host Test Results 1 files + 1 1 suites +1 4h 51m 24s ⏱️ + 4h 51m 24s For more details on these errors, see this check. Results for commit 6798b2b. ± Comparison against base commit b2f81bb. ♻️ This comment has been updated with latest results. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 98321845b0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
packages/host/tests/live-test.js
Outdated
| loader.shimModule('qunit', QUnit); | ||
| loader.shimModule('@cardstack/host/tests/helpers', helpers); | ||
| loader.shimModule('@cardstack/host/tests/helpers/mock-matrix', mockMatrix); | ||
| loader.shimModule('@cardstack/host/tests/helpers/setup', testSetup); | ||
| loader.shimModule('@cardstack/host/tests/helpers/adapter', helperAdapter); |
There was a problem hiding this comment.
Shim live-test package imports before loading realm module
loadRealmTests() only shims qunit and @cardstack/host/tests/helpers*, but the default module it imports (sample-command-card.gts) has runtime imports from @ember/service, @ember/test-helpers, and @universal-ember/test-support. In this loader stack, bare specifiers resolve to package URLs and must be shimmed, so await loader.import(${realmURL}${testModule}) will fail as soon as those imports are evaluated. Please shim those modules (or avoid runtime imports of them in the realm file) before importing the test module.
Useful? React with 👍 / 👎.
packages/host/tests/live-test.html
Outdated
| <script src="/assets/test-support.js"></script> | ||
| <script src="/assets/@cardstack/host.js"></script> |
There was a problem hiding this comment.
Disable QUnit autostart before loading test-support bundle
live-test.html currently loads /assets/test-support.js before /assets/live-test.js, but test-support executes tests/test-helper.js, which unconditionally calls start() and starts QUnit immediately. That makes QUnit.config.autostart = false in live-test.js too late, so the run can start/finish before the realm module is imported (resulting in zero/missing realm tests or mixed host-suite execution). Move the live-test bootstrap (or an early autostart=false script) ahead of test-support.js.
Useful? React with 👍 / 👎.
Preview deployments |
No description provided.