aglinxinyuan opened a new issue, #7842:
URL: https://github.com/apache/texera/issues/7842

   ### Task Summary
   
   Four things in 
`frontend/src/app/workspace/component/code-editor-dialog/code-editor.component.ts`
 have no assertions: the `monacoWorkerFactory` label switch, the dynamic 
codingame extension imports, the retry-clearing `catch`, and the LSP timeout 
reject.
   
   PR #7735 named exactly these and declined them, with this reason:
   
   > All sit behind `ensureVscodeApiStarted()`, a process-wide singleton both 
suites stub; reaching them means booting the real codingame stack.
   
   **That reason is wrong on both halves, and establishing so is the first step 
of this task.**
   
   1. The jsdom spec stubs nothing. `grep -n 'vi.mock|vi.doMock'` over 
`code-editor.component.spec.ts` returns zero hits, and there is no 
`ensureVscodeApiStarted` stub anywhere in it.
   2. `ensureVscodeApiStarted()` genuinely resolves under jsdom — a real monaco 
editor mounts over a real text model.
   
   And `getEnhancedMonacoEnvironment()` is not a barrier either: in 
`monaco-languageclient/lib/vscode/utils.js` it does `if (typeof 
MonacoEnvironment === 'undefined') globalThis.MonacoEnvironment = {}` and 
returns that same global. `configureMonacoWorkers()` runs at the top of 
`start()`, before any dynamic import, so the factory installs 
`MonacoEnvironment.getWorker` on the way in regardless of what fails later. The 
worker factory is therefore reachable from any jsdom test.
   
   Traps worth knowing before writing anything:
   
   1. **A single-file green run proves nothing for `new Worker(new 
URL(...))`.** `--include` runs one file, but a suite-wide run changes how the 
component is chunked, which changes `import.meta.url`, which changes every 
bundler-rewritten worker URL. A test comparing full URLs passes alone and fails 
in the full run. Compare only the content-hashed chunk file name plus query, 
and always finish with a full `npx ng test --watch=false`.
   2. **`{ type: "module" }` on a worker construction is unassertable.** The 
bundler's worker plugin rewrites the whole expression and supplies the options 
itself, so the recorded options are `{"type":"module"}` whether or not the 
source literal is present. Only the label to entry-point mapping can be pinned.
   3. **This runner does not fail on unhandled rejections**, so a test named 
"swallows both failures" can pass with both `.catch(() => {})` handlers 
deleted. Pinning that needs a thenable that records whether the caller attached 
a rejection handler.
   4. **Most of the reported gap is a measurement artifact.** `build.yml` runs 
the browser target with no `--coverage` and the Codecov upload takes only the 
jsdom lcov, so roughly 29 of the missed lines are already exercised by 
browser-mode tests that never report. Only about 8 lines are genuinely untested 
— target those, and state both numbers.
   
   ### Task Type
   
   - [ ] Refactor / Cleanup
   - [ ] DevOps / Deployment / CI
   - [x] Testing / QA
   - [ ] Documentation
   - [ ] Performance
   - [ ] Other
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to