Repository navigation
build: build and test with Vite - #1356
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1356 +/- ##
==========================================
+ Coverage 90.00% 93.75% +3.75%
==========================================
Files 3 3
Lines 80 80
Branches 20 20
==========================================
+ Hits 72 75 +3
+ Misses 6 3 -3
Partials 2 2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This was referenced Nov 30, 2026
Vite builds the same ESM and CommonJS entries that rollup with swc did, unminified and for modern targets, so the pure annotations reach the bundlers of consumers. Declarations are emitted from tsconfig.build.json, and the scripts follow the Trigen baseline.
Specs live beside the code they test, and tsd type tests become @ts-expect-error cases in them, checked by tsc and by Vitest typecheck.
swc added them to the build, Vite does not: without them a bundler keeps Chart and its Chart.js core even when only an event helper is imported. The annotations are in the sources now, and size-limit measures a helper-only import. The type test of plugins on the generic Chart, lost in the move from tsd, is back.
The specs checked only the props types, so the render function of the typed components was never run.
With empty datasets Chart.js never looks up the controller, so the tests passed even without the controller registration. Each test now checks one behavior.
dangreen
marked this pull request as ready for review
November 30, 2026 15:35
This was referenced Nov 30, 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.
Part 3 of the tooling stack. Based on #1355.
What
dist/index.js(ESM),dist/index.cjs(CommonJS) anddist/index.d.ts. The output is unminified and built foresnext, so the/* @__PURE__ */annotations reach the bundlers of consumers. React and Chart.js stay external./* @__PURE__ */to theforwardRefcalls in the build; Vite does not, and without them a bundler keptChartand the Chart.js core even for an import of a single event helper (149 B grew to ~122 kB in a consumer bundle). The annotations are written insrcnow, and size-limit has an entry for{ getElementAtEvent }(57 B) to keep it that way.Argue:tsconfig.build.jsonemits declarations fromsrc,tsconfig.jsontype-checks everything including specs and config files.verbatimModuleSyntaxis on.src/*.spec.tsx(theunit-testsskill).tsdis gone: its cases are@ts-expect-errorchecks and positive cases inside the specs, verified bytsc --noEmit(test:types) and Vitest typecheck. New runtime tests render<Scatter>and<Doughnut>and check the registered controller, the ref and the options, so the render function of the typed components is covered too.build,lint,test:unit,test:types,test:size,test(run -p lint test:unit test:typesfrom@trigen/scripts),clear.prepublishOnlyruns tests and the build before clean-publish..clean-publishdropsscriptsandpublishConfigfrom the publishedpackage.json(clean-publish appliespublishConfigfields first, somain,moduleandexportsare as before).linkDirectory: falsekeeps local consumers of the package on the sources.ESLint still runs in this PR; the next one replaces it with oxlint.
Checked locally
pnpm test,pnpm build,pnpm test:size(sizes unchanged: 857 B for everything, 538 B forChart, 590 B forLine; 57 B for an event helper).pnpm prepublishOnlyproduces apackage/package.jsonwith the samemain,module,exportsandtypesas the current release.Stack
🤖 Generated with Claude Code