Skip to content

test: add unit tests for RegressionX/Y marks (#169)#378

Merged
gka merged 3 commits into
svelteplot:mainfrom
ljodea:test/regression-169
Feb 17, 2026
Merged

test: add unit tests for RegressionX/Y marks (#169)#378
gka merged 3 commits into
svelteplot:mainfrom
ljodea:test/regression-169

Conversation

@ljodea

@ljodea ljodea commented Feb 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Adds 10 unit tests for the RegressionY mark covering linear/quadratic/loess regression types, confidence bands, grouping by stroke/z channels, custom CSS classes, and empty data
  • Adds 4 unit tests for the RegressionX mark covering axis swap (dependent=x → regression-y class), confidence bands, stroke grouping, and empty data
  • All 14 tests pass alongside the existing 451+ tests with no regressions

Closes #169

Test plan

  • npx vitest run src/tests/regressionY.test.svelte.ts — 10 tests pass
  • npx vitest run src/tests/regressionX.test.svelte.ts — 4 tests pass
  • npx vitest run — full suite passes (465 tests)
  • npm run lint — clean

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@netlify

netlify Bot commented Feb 16, 2026

Copy link
Copy Markdown

Deploy Preview for svelteplot ready!

Name Link
🔨 Latest commit b5bf32b
🔍 Latest deploy log https://app.netlify.com/projects/svelteplot/deploys/6993dc28158a7d00080f80e3
😎 Deploy Preview https://deploy-preview-378--svelteplot.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Prevents flaky jsdom "Cannot read properties of null" errors in
canvas tests by awaiting Svelte's async reactive teardown and
cancelling orphaned requestAnimationFrame callbacks in afterEach.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ljodea

ljodea commented Feb 16, 2026

Copy link
Copy Markdown
Collaborator Author

Added fix for the flaky jsdom Cannot read properties of null (reading '_location') error in canvas tests.

What changed (src/tests/setup.ts):

  • afterEach now flushes pending microtasks (setTimeout(0)) so Svelte's async reactive teardown completes before jsdom destroys the window
  • Cancels orphaned requestAnimationFrame callbacks that would otherwise fire on the destroyed window

Verification: Full suite (npx vitest run) ran 5 consecutive times with 0 errors (previously ~80% failure rate).

@gka gka merged commit 4846d98 into svelteplot:main Feb 17, 2026
8 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.

Add unit tests for RegressionX/Y marks

2 participants