Skip to content

feat(@joint/mock-svg): Standalone plugin for SVG DOM mocking - #3519

Merged
zbynekstara merged 17 commits into
clientIO:masterfrom
zbynekstara:standalone-mock-svg
Sep 29, 2026
Merged

zbynekstara merged 17 commits into
clientIO:masterfrom
zbynekstara:standalone-mock-svg

Conversation

@zbynekstara

Copy link
Copy Markdown
Contributor

Description

Adds @joint/mock-svg as a standalone plugin for SVG DOM mocking.

Changes @joint/vitest-plugin-mock-svg to use this plugin as source of truth for the mocks. The mocks in @joint/mock-svg are as close as possible to this original version.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Add focused tests for the standalone mocks and correct the documented import examples.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 Medium severity · 1 Low severity

Open (2)
What changed in this PR

Adds standalone @joint/mock-svg SVG DOM mocks and updates the Vitest plugin to consume them.

Changes:

  • Adds the new package, build configuration, documentation, and mocks.
  • Updates the Vitest plugin to use shared mocks.
  • Updates workspace metadata and changesets.
File Description
yarn.lock Registers workspace dependencies.
packages/​joint-vitest-plugin-mock-svg/​README.md Documents plugin usage and customization.
packages/​joint-vitest-plugin-mock-svg/​package.json Adds the standalone mock dependency.
packages/​joint-vitest-plugin-mock-svg/​mocks/​vite.config.ts Externalizes the mock package.
packages/​joint-vitest-plugin-mock-svg/​mocks/​index.ts Imports shared mocks.
packages/​joint-vitest-plugin-mock-svg/​.gitignore Updates ignored artifacts.
packages/​joint-mock-svg/​vite.config.ts Configures library builds.
packages/​joint-mock-svg/​tsconfig.json Configures declarations and type checking.
packages/​joint-mock-svg/​src/​index.ts Implements SVG and ResizeObserver mocks.
packages/​joint-mock-svg/​SECURITY.md Adds security policy.
packages/​joint-mock-svg/​README.md Documents standalone package usage.
packages/​joint-mock-svg/​package.json Defines package metadata and exports.
packages/​joint-mock-svg/​LICENSE Adds MIT licensing.
packages/​joint-mock-svg/​eslint.config.mjs Adds lint configuration.
packages/​joint-mock-svg/​.gitignore Ignores generated artifacts.
.changeset/​olive-moons-repeat.md Records the new package release.
.changeset/​afraid-donkeys-invite.md Records the Vitest plugin update.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread packages/joint-mock-svg/src/index.ts
Comment thread .changeset/afraid-donkeys-invite.md Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Unresolved critical and moderate type-checking issues remain.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 High severity

Open (1)
Resolved since last review (2)

Comment thread packages/joint-mock-svg/test/jest/src/mocks.test.ts

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

A moderate dependency typing issue and several documentation/changeset corrections remain unresolved.

Review effort: Lite
Findings: None

Resolved since last review (1)

Both READMEs carried the MIT text verbatim alongside the LICENSE file
next to them, so each package shipped the same legal text twice. Two
copies drift: a year, a holder or a future relicence gets changed in one
and not the other, and the package then ships two licences that disagree.

The LICENSE file stays authoritative, which is what npm always packs and
what tooling reads. Both READMEs now link to it with a copyright line,
matching core, react, decorators, shapes-general and the rest. The
verbatim text was the only instance of its kind in the monorepo, in
vitest-plugin-mock-svg, and the new package had inherited it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The mocks were 39 `vi.fn()` calls and are now plain functions, so
`expect(el.getBBox).toHaveBeenCalled()` and `getBBox.mockReturnValue()`
both stop working. The changeset named the replacement and the migration
but not the break, which is the part a reader scanning the changelog
needs to see.

`minor` stays the right bump: the package is 0.3.1, and a 0.x minor may
break.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@zbynekstara
zbynekstara merged commit 0b3fdad into clientIO:master Sep 29, 2026
3 checks passed
@zbynekstara
zbynekstara deleted the standalone-mock-svg branch September 29, 2026 10:38
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.

Extract the SVG mocks out of the Vitest plugin, so a Jest project can use them too

3 participants