Skip to content

test(frontend): extend code-debugger and code-editor coverage#5191

Merged
Yicong-Huang merged 1 commit into
apache:mainfrom
Yicong-Huang:test/code-editor-debugger-coverage
May 24, 2026
Merged

test(frontend): extend code-debugger and code-editor coverage#5191
Yicong-Huang merged 1 commit into
apache:mainfrom
Yicong-Huang:test/code-editor-debugger-coverage

Conversation

@Yicong-Huang
Copy link
Copy Markdown
Contributor

@Yicong-Huang Yicong-Huang commented May 24, 2026

What changes were proposed in this PR?

Extends the existing code-debugger.component.spec.ts and code-editor.component.spec.ts with tests for the class-level surface that the original specs left behind. No Monaco-editor interaction is added — the parts that require a real editor are left for a future browser-mode pass.

A latent test-setup bug surfaced while writing the new debugger tests: the spec built debugState from new Y.Map<…>() directly, which silently never fires observers because the map is not attached to a Y.Doc. Production never hits this — UdfDebugService hands out maps from a real doc — but every Y.Map observer test would have stayed at 0 coverage until the map was wired into a doc. Switching to new Y.Doc().getMap(…) fixes it.

Any related issues, documentation, discussions?

Closes #5190.

How was this PR tested?

yarn ng test --watch=false --include=… runs 2 spec files / 39 tests, all green. yarn lint and yarn format:ci both clean.

Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Opus 4.7

Add tests for the class-level surface area both specs were leaving
behind.

`code-debugger`: cover the Y.Map observer in
registerBreakpointRenderingHandler (add / delete / hit-flip /
condition-change branches), rerenderExistingBreakpoints, and the
defined-and-undefined paths of removeMonacoBreakpointMethods. The
spec used to build `debugState` from `new Y.Map<…>()` directly, which
silently never fires observers because the map is not attached to a
Y.Doc; switch to `new Y.Doc().getMap(…)` so observer-based assertions
work. Line coverage rises 38% → 76%.

`code-editor`: cover getFileSuffixByLanguage's full branch table, the
onFocus highlight wiring, acceptCurrentAnnotation's no-op and
suggestion-acceptance paths, rejectCurrentAnnotation's UI clearing and
multi-variable continuation, and the AI-assistant gate. The
Monaco-bound paths (initializeMonacoEditor's editor-bound subscribe
body, initializeDiffEditor, setupAIAssistantActions' addAction
callbacks) still need a real Monaco editor to run and are left for a
future browser-mode pass. Line coverage rises 38% → 49%.

Closes apache#5190
@github-actions github-actions Bot added the frontend Changes related to the frontend GUI label May 24, 2026
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 44.66%. Comparing base (cfc6d9a) to head (8414f99).

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #5191      +/-   ##
============================================
+ Coverage     44.54%   44.66%   +0.11%     
  Complexity     2217     2217              
============================================
  Files          1042     1042              
  Lines         39989    39989              
  Branches       4260     4260              
============================================
+ Hits          17814    17860      +46     
+ Misses        21059    21012      -47     
- Partials       1116     1117       +1     
Flag Coverage Δ *Carryforward flag
access-control-service 39.53% <ø> (ø) Carriedforward from cfc6d9a
agent-service 33.76% <ø> (ø) Carriedforward from cfc6d9a
amber 45.74% <ø> (ø) Carriedforward from cfc6d9a
computing-unit-managing-service 0.00% <ø> (ø) Carriedforward from cfc6d9a
config-service 0.00% <ø> (ø) Carriedforward from cfc6d9a
file-service 32.18% <ø> (ø) Carriedforward from cfc6d9a
frontend 36.02% <ø> (+0.28%) ⬆️
python 90.50% <ø> (ø) Carriedforward from cfc6d9a
workflow-compiling-service 56.81% <ø> (ø) Carriedforward from cfc6d9a

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Yicong-Huang Yicong-Huang added this pull request to the merge queue May 24, 2026
Merged via the queue into apache:main with commit a25c543 May 24, 2026
21 checks passed
@Yicong-Huang Yicong-Huang deleted the test/code-editor-debugger-coverage branch May 24, 2026 23:05
aglinxinyuan added a commit to aglinxinyuan/texera that referenced this pull request May 25, 2026
Conflicts in `frontend/package.json` and `frontend/yarn.lock` from
two changes that landed on main after the last rebase:

* `@lezer/python@1.1.18` was added in apache#5043 for the new Python UDF
  UI parameter form. Kept as-is — independent of the monaco upgrade.
* `@codingame/monaco-vscode-{java,python}-default-extension` jumped
  from `8.0.4` (main) to `25.1.2` (PR side). Kept the PR side; that's
  the whole point of this branch. `r-default-extension` stays dropped
  per the PR's `What gets dropped` section.

Knock-on: apache#5191 added unit tests on main that pin a
`getFileSuffixByLanguage` private method and stub `editorWrapper` in
the `acceptCurrentAnnotation` path. The v10 rewrite had inlined the
suffix logic as a ternary at the two call sites and renamed
`editorWrapper` -> `editorApp`. Restored the helper (cleaner anyway,
and brings back `javascript` / case-insensitivity that the ternary
silently dropped) and pointed the test stub at `editorApp` so both
PRs' test surfaces stay green together.

Verified on the merged tree:
* `yarn install` clean (only the pre-existing monaco-breakpoints
  peer-dep warning, same as before the merge)
* `yarn build` exits 0
* `yarn test --watch=false` -> 510 pass / 0 fail / 2 skip / 2 todo
* `yarn lint` and `yarn format:ci` both clean
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend Changes related to the frontend GUI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

code-editor and code-debugger component specs leave most class logic uncovered

3 participants