Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The split introduced a fragile teardown in tests/hiddenSyntax/support.ts and appears to have dropped the “keeps HTML source visible” regression test.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR reorganizes the previously monolithic tests/hiddenSyntax.test.ts into focused per-feature test files under tests/hiddenSyntax/, introducing shared test utilities/mocks to keep the suite maintainable and easier to navigate.
Changes:
- Split
tests/hiddenSyntax.test.tsinto multiple targetedtests/hiddenSyntax/*.test.tsfiles (inline, links, headings, blockquotes, lists, selection, mode, blocks). - Added
tests/hiddenSyntax/support.tsto centralize Mermaid mocking and shared DOM/editor helpers. - Fixed relative imports in
tests/hiddenSyntax/hiddenSyntax.bench.tsafter the directory reshuffle.
File summaries
| File | Description |
|---|---|
| tests/hiddenSyntax/unorderedList.test.ts | New focused tests for unordered list + task-prefix interactions. |
| tests/hiddenSyntax/support.ts | Shared Vitest hooks/helpers and Mermaid mocks for hidden-syntax tests. |
| tests/hiddenSyntax/selection.test.ts | New focused tests for vertical motion and pointer selection behaviors. |
| tests/hiddenSyntax/mode.test.ts | New focused tests for enabling/disabling syntax-hidden mode. |
| tests/hiddenSyntax/link.test.ts | New focused tests for link/image hiding, icons, and navigation. |
| tests/hiddenSyntax/inline.test.ts | New focused tests for inline code/strong/italic/strike and editing flows. |
| tests/hiddenSyntax/hiddenSyntax.bench.ts | Updated import paths to match new test folder layout. |
| tests/hiddenSyntax/heading.test.ts | New focused tests for ATX + Setext heading hiding/reveal rules. |
| tests/hiddenSyntax/blockquote.test.ts | New focused tests for blockquote bars and GitHub alert markers. |
| tests/hiddenSyntax/block.test.ts | New focused tests for inline images, block math, Mermaid blocks, and horizontal rules. |
| tests/hiddenSyntax.test.ts | Removed monolithic hidden-syntax test file after split. |
Review details
- Files reviewed: 11/11 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| describe('Strikethrough syntax', () => { | ||
| test('hides both marks and reveals them when selected', () => { | ||
| const source = 'Before ~~deleted~~ after'; | ||
| editor.setUp(source, hiddenSyntaxExtension); | ||
| window.editor.dispatch({ selection: { anchor: source.length } }); | ||
|
|
||
| expect(editorText()).toBe('Before deleted after'); | ||
| expect(window.editor.state.doc.toString()).toBe(source); | ||
|
|
||
| window.editor.dispatch({ selection: { anchor: 11 } }); | ||
| expect(editorText()).toBe(source); | ||
| }); | ||
| }); |
There was a problem hiding this comment.
🔵 Needs a closer look
The shared afterEach in tests/hiddenSyntax/support.ts unconditionally destroys window.editor, which can throw in tests that don’t create an editor (e.g., widget-only tests) and can break isolated test runs.
Review details
Suppressed comments (1)
tests/hiddenSyntax/support.ts:21
afterEachunconditionally callswindow.editor.destroy(), but this file is imported by tests that don't create an editor (e.g. the widget-onlyignoreEvent()tests inblock.test.ts). Running those tests in isolation (or if setup fails early) will throw during teardown and mask the real failure. Guard the destroy call so teardown is safe whenwindow.editoris absent.
afterEach(() => {
vi.restoreAllMocks();
window.editor.destroy();
document.body.innerHTML = '';
});
- Files reviewed: 11/11 changed files
- Comments generated: 0 new
- Review effort level: Lite
No description provided.