Skip to content

Add tests that exercise the built package, not just source - #297

Draft
zoharma wants to merge 1 commit into
mainfrom
zma/add-consumer-smoke-test
Draft

zoharma wants to merge 1 commit into
mainfrom
zma/add-consumer-smoke-test

Conversation

@zoharma

@zoharma zoharma commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Source-only tests never touch dist/, so the utif bundling regression only surfaced once a real consumer imported the published package.

pnpm test:dist (test/*.test.ts, needs pnpm build first) covers:

  • dist-entrypoints: every dist/*.{esm,cjs}.js entry point loads without throwing
  • no-unexpected-bundling: utif still shows up as an external import, not inlined
  • dist-size: total dist/*.js size hasn't grown >25% past a committed baseline

pnpm test:consumer-smoke (scripts/consumer-smoke-test.sh) packs the built package into a tarball and installs it into two throwaway fixtures, importing every entry point like a real consumer would:

  • e2e/consumer-smoke: floating Vitest, general build health
  • e2e/consumer-smoke-legacy-vitest: pinned to vitest 4.0.18/vite 7.3.5, the exact versions that hit the 0.7.1 crash - the underlying Vite bug is already fixed in newer versions, so this is the only fixture that actually reproduces it and guards against a regression

Both scripts run in CI after pnpm build. e2e/ fixtures are excluded from ESLint's typed linting and from the default pnpm test run, since they're isolated projects with their own dependencies.

@zoharma
zoharma force-pushed the zma/add-consumer-smoke-test branch from b04b8a4 to 3b3a92a Compare September 16, 2026 15:38
Source-only tests never touch dist/, so the utif bundling regression
only surfaced once a real consumer imported the published package.
`pnpm test:dist` (test/*.test.ts, needs `pnpm build` first) covers:
- `dist-entrypoints`: every dist/*.{esm,cjs}.js entry point loads without throwing
- `no-unexpected-bundling`: utif still shows up as an external import, not inlined
- `dist-size`: total dist/*.js size hasn't grown >25% past a committed baseline

`pnpm test:consumer-smoke` (scripts/consumer-smoke-test.sh) packs the
built package into a tarball and installs it into two throwaway
fixtures, importing every entry point like a real consumer would:
- `e2e/consumer-smoke`: floating Vitest, general build health
- `e2e/consumer-smoke-legacy-vitest`: pinned to vitest 4.0.18/vite 7.3.5,
  the exact versions that hit the 0.7.1 crash - the underlying Vite bug is
  already fixed in newer versions, so this is the only fixture that
  actually reproduces it and guards against a regression

Both scripts run in CI after `pnpm build`. e2e/ fixtures are excluded
from ESLint's typed linting and from the default `pnpm test` run,
since they're isolated projects with their own dependencies.
@zoharma
zoharma force-pushed the zma/add-consumer-smoke-test branch from 192f20c to cf56eaa Compare September 16, 2026 20:40
@zoharma

zoharma commented Sep 17, 2026

Copy link
Copy Markdown
Contributor Author

@VictoriaBeilsten-Edmands @douglaswinter @akademy take a look at this. A few tests added. Still a draft.

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.

1 participant