Repository navigation
FE-2027: Load the editor's Monaco before the Petrinaut website editor tests - #10111
Conversation
Mounting the editor starts loading its bundled Monaco. In a parallel run that load outlasts the one-second waits of the first test in each file that mounts the editor, so the share and walkthrough plugin tests failed intermittently. The shared `renderEditorWith` helper now mounts the editor once before each file's tests and waits for the load to finish. With Monaco loaded, the command palette closes synchronously and is detached together with its overlay, so `waitForElementToBeRemoved` never saw it go. Wait for the dialog to be gone instead.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
PR SummaryLow Risk Overview The shared The command palette close test no longer uses Reviewed by Cursor Bugbot for commit 4e66f51. Bugbot is set up for automated code reviews on this repo. Configure here. |
Requested by Bilal Mahmoud · Slack thread
🌟 Purpose
The Petrinaut website tests that mount the full editor fail now and then in
Unit (@apps/petrinaut-website)on PRs that don't touch them, for example #9873 and #9944. The cause is in the shared test setup, not in the tests themselves: mounting the editor starts loading its bundled Monaco, and in a parallel run that load is still going during the first test of each file.This PR loads Monaco once before each file's tests, and fixes the command palette test, which failed whenever Monaco had already loaded.
🔍 Changes
renderEditorWithregisters abeforeAllthat mounts the editor, waits until the editor has assignedMonacoEnvironment.getWorker(it does that once Monaco has loaded), then unmounts. Every test file that uses the helper gets this.waitForElementToBeRemoved(palette). Once Monaco has loaded, the palette closes synchronously and is detached along with its overlay, sowaitForElementToBeRemovednever saw it go.preloadMonaco()inpetrinaut-jsdom.tsimports themonaco-editorpackage, which is a different copy from the one bundled into@hashintel/petrinaut'sdist, so it doesn't warm the editor's Monaco. Its two users are unchanged here.live-conversation.test.tsandvoice-history-continuity.test.tsxstill flake. They don't userenderEditorWith, and this PR doesn't change them.Generated by Claude Code