Skip to content

fix(core): keep theme test files out of dist - #655

Merged
wemra3 merged 5 commits into
mainfrom
claude/zealous-gagarin-1e6322
Oct 28, 2026
Merged

wemra3 merged 5 commits into
mainfrom
claude/zealous-gagarin-1e6322

Conversation

@wemra3

@wemra3 wemra3 commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

packages/core/vite.config.ts sets publicDir: "src/assets", so the build copies every file in src/assets into dist/. theme-bridge.test.ts was in src/assets, so it was copied into dist/ and published to npm. @tailor-platform/app-shell@1.17.0 contains package/dist/theme-bridge.test.ts (and package/dist/semantic-contrast.test.ts, which #641 has removed).

Changes

  • Move theme-bridge.test.ts to packages/core/tests/, next to the other CSS tests. The CSS paths now start from ../src/assets, the same as in typography-compile.test.ts.
  • Update the comment in typography-compile.test.ts that points to this file.
  • Add a patch changeset, because the package contents change.

publicDir is not changed. Theme CSS, fonts and the other assets still ship as before.

After #641, this PR no longer changes vitest.config.ts (#641 added the dist/** exclude) or semantic-contrast.test.ts (#641 removed it). The !dist/**/*.test.* entry in files is also removed: no test file is in src/assets now, so nothing copies one into dist/.

Verification

  • After pnpm build, packages/core/dist/ has no *.test.* files.
  • npm pack --dry-run in packages/core lists no test files.
  • fmt:check, lint, type-check, test, docs:check and build pass.

🤖 Generated with Claude Code

Hiroki Uemura and others added 2 commits October 25, 2026 09:23
`publicDir: "src/assets"` copies every file in src/assets into dist/, so
semantic-contrast.test.ts and theme-bridge.test.ts were published to npm
and, after a local build, ran twice under vitest.

Move both tests to packages/core/tests/ next to the other CSS tests, and
exclude dist/** from vitest so build output is never collected as tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`publicDir` copies all of src/assets into dist/, so a test file added
there later would ship again. The dist/ exclusion in vitest also hides
the duplicate run that would otherwise reveal it. Exclude
`dist/**/*.test.*` in `files` so such a file never reaches npm.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@wemra3
wemra3 requested a review from a team as a code owner October 28, 2026 00:11
@github-actions

github-actions Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Code Metrics Report

main (5db7473) #655 (db163a3) +/-
Coverage 89.5% 89.5% 0.0%
Test Execution Time 2m7s 3m6s +59s
Details
  |                     | main (5db7473) | #655 (db163a3) | +/-  |
  |---------------------|----------------|----------------|------|
  | Coverage            |          89.5% |          89.5% | 0.0% |
  |   Files             |            236 |            236 |    0 |
  |   Lines             |           7512 |           7512 |    0 |
  |   Covered           |           6727 |           6727 |    0 |
- | Test Execution Time |           2m7s |           3m6s | +59s |

Reported by octocov

Comment thread packages/core/package.json Outdated
},
"files": [
"dist/**",
"!dist/**/*.test.*",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we still need this?

Comment thread packages/core/vitest.config.ts Outdated
test: {
environment: "happy-dom",
// `pnpm build` writes to dist/. Keep any test file there out of the run.
exclude: [...configDefaults.exclude, "dist/**"],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This seems redundunt. Why does pnpm build write files in dist?

@wemra3

wemra3 commented Oct 28, 2026

Copy link
Copy Markdown
Contributor Author

@IzumiSy Thanks. You are right about both.

After #641 is merged, I will update this PR so that it only moves theme-bridge.test.ts to tests/ and keeps the changeset. That file is still in src/assets, so it is still published to npm.

#641 removed semantic-contrast.test.ts and added the dist/** exclude, so
this PR now only moves theme-bridge.test.ts out of src/assets. Drop the
!dist/**/*.test.* guard in files: no test file is copied into dist/ now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@wemra3
wemra3 requested a review from IzumiSy October 28, 2026 12:48
@wemra3
wemra3 merged commit eee5b85 into main Oct 28, 2026
7 checks passed
@wemra3
wemra3 deleted the claude/zealous-gagarin-1e6322 branch October 28, 2026 23:22
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.

2 participants