Skip to content

test(desktop): make MermaidRenderer tests independent of order - #210

Merged
GoDiao merged 2 commits into
GoDiao:mainfrom
KingEmma7:test/mermaid-renderer-order
Oct 30, 2026
Merged

GoDiao merged 2 commits into
GoDiao:mainfrom
KingEmma7:test/mermaid-renderer-order

Conversation

@KingEmma7

Copy link
Copy Markdown
Contributor

Closes #206.

Keep initializeMock history for the lifetime of the cached Mermaid module and assert that initialization ran exactly once. renderMock still resets before each test. Includes the required changelog entry; production code is unchanged.

Validation on 69e4c954 (macOS arm64, Bun 1.4.3, Node 24.19.0):

  • Seed 11 reproduces the failure before the fix. Seeds 1, 2, 3, 11 and 23 pass afterward.
  • Desktop bun run lint: passed.
  • Desktop bun run test -- --run: 1,618 passed, 4 skipped across 159 files.
  • Server tests with the filter below: 1,485 passed, 3 filtered out, 0 failed across 121 files.
Local server-test limitation and command

Three tests in src/server/__tests__/filesystem.test.ts create fixtures directly in the user's home directory. Local write restrictions prevented those tests, so they remain unverified locally. The remaining server tests ran with local service access. The unfiltered server suite is not claimed as passing.

bun test --test-name-pattern '^(?!.*(?:allows browsing a directory under the user home directory|fuzzy searches files and directories below the selected root|falls back to ripgrep search outside git and still respects ignore files))'

@GoDiao GoDiao left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @KingEmma7, and welcome! This is the fix #206 suggested: the test no longer clears initializeMock, and it now asserts that initialize ran exactly once. We ran the file with your seeds (1, 2, 3, 11 and 23) and in file order, and all pass. With the old test file, seed 11 fails the first test, so your reproduction holds.

We pushed one small commit on top that removes the CHANGELOG entry. The changelog lists changes users can see, and this PR only changes a test, so it gets no entry (earlier test-only PRs didn't either).

Approving and merging. If you find DreamCoder useful, a ⭐ on the repo would mean a lot to us. Thanks again!

@GoDiao
GoDiao merged commit 2794ca0 into GoDiao:main Oct 30, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MermaidRenderer test fails when its tests run in a different order

2 participants