Repository navigation
test: run the decimation, filler, legend, title and tooltip plugin specs under Vitest - #12509
Merged
Merged
Conversation
…ecs under Vitest
Rename plugin.{decimation,filler,legend,title,tooltip}.tests.js to
*.spec.js and convert their Jasmine idioms with the table in design D5.
The four fixture lines go; fixtures.spec.js already runs those
directories. The D5 table gains the two spy idioms title uses:
.and.returnValue(v) and .calls.mostRecent().args.
✅ Deploy Preview for chartjs-docs canceled.
|
|
Size Change: 0 B Total Size: 364 kB ℹ️ View Unchanged
|
kurkle
marked this pull request as ready for review
November 26, 2026 04:40
etimberg
approved these changes
Nov 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Piece P10 of
openspec/changes/migrate-tests-to-vitest. It follows #12436 (Vitest beside Karma) and #12444 (fixtures under Vitest), and uses the same recipe as #12496, #12498, #12499, #12505 and #12506. Base: f92cce7.What was missing
plugin.decimation,plugin.filler,plugin.legend,plugin.titleandplugin.tooltipstill ran under Karma/Jasmine. Open pull requests touch these files. By design D13 they do not hold the conversion; they are listed below.What changed
Each file is renamed with
git mvfrom*.tests.jsto*.spec.js, so git follows every rename: decimation 100%, filler, legend and title 97%, tooltip 92%. The idioms are converted with the table in design D5:describe('auto', jasmine.fixture.specs(...))fixtures.spec.jsalready runs these directoriesspyOn(o, 'm')vi.spyOn(o, 'm').mockImplementation(() => {})console.warntwice in filler,tooltip.updateonce)spyOn(o, 'm').and.callThrough()vi.spyOn(o, 'm')tooltip.update,positioners.test).calls.count()/.calls.first().args/.calls.reset().mock.calls.length/.mock.calls[0]/.mockClear().calls.first().object.mock.contexts[0]jasmine.objectContaining/jasmine.anyexpect.objectContaining/expect.anyjasmine.triggerMouseEvent(triggerMouseEvent(plugin.decimationuses no Jasmine idiom; only the rename moves it.Two idioms beyond the D5 table, both in
plugin.title. They are added to the D5 table indesign.md:jasmine.createSpy('padding').and.returnValue(value)becomesvi.fn(() => value).padding.calls.mostRecent().args[0]becomespadding.mock.lastCall[0].The recorded
this. The positioner test assertsfn.mock.contexts[0] instanceof Tooltip.src/plugins/plugin.tooltip.jscalls the positioner with.call(this, ...)from the Tooltip instance (lines 651, 1012 and 1219). So the recordedthisis neverundefinedornull, and the strict-mode difference in D5 does not apply.No deliberate-break check. None of the five files has a
function(done)test, abeforeEach/afterEachhook orthis.state. No expectation runs inside a callback: the legendonClick/onHover/onLeavecallbacks only assign local variables, and the tests assert afterawait triggerMouseEvent(...). Every expectation runs in a test body, so there is no expectation whose failure could be lost.Stale comments are deleted:
// Test the rectangle elementat the top ofplugin.legend,plugin.titleandplugin.tooltip.// jasmine.createSpy('warn');inplugin.filler.toEqualstaystoEqual. No imports are added andtest/setup.jsis unchanged.openspec/changes/migrate-tests-to-vitest/tasks.md: 10.2, 10.3 and 10.4 are ticked. 10.1 stays open until the rebase comments are posted after merge.Open pull requests that touch these files
Each of these gets a comment with the rebase recipe (the table in D5) after this merges. The list was checked with
gh pr listagainst the five spec paths.plugin.decimationplugin.fillerplugin.legendplugin.tooltipNo open pull request touches
plugin.title.Counts
Local runs on macOS on f92cce7, full suite of each runner, per browser:
jasmine.fixture.specslines.--grepon each file before the change gave, per browser:--greprunplugin.decimationplugin.fillerplugin.legendplugin.titleplugin.tooltipit (. That regex finds 97 literalitcalls; loops generate the other 6:forEach.forEach.forEach.vitest run --browser.headless test/specs/plugin.decimation test/specs/plugin.filler test/specs/plugin.legend test/specs/plugin.title test/specs/plugin.tooltipexits 1 with "No test files found, exiting with code 1".plugin.filler/line,scale.time,scale.timeseriesandscale.radialLinear/ticks-below-zero(that last one in Chromium only). These are known macOS rendering differences; CI on Ubuntu is the judge.How to try it