From 68b35cccb408b070126a84732bdd04786fe2f54e Mon Sep 17 00:00:00 2001 From: Hiroki Uemura Date: Sun, 25 Oct 2026 09:23:19 +0900 Subject: [PATCH 1/2] fix(core): keep theme test files out of dist `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 --- .changeset/no-tests-in-dist.md | 5 +++++ .../core/{src/assets => tests}/semantic-contrast.test.ts | 7 +++++-- packages/core/{src/assets => tests}/theme-bridge.test.ts | 6 +++--- packages/core/tests/typography-compile.test.ts | 2 +- packages/core/vitest.config.ts | 4 +++- 5 files changed, 17 insertions(+), 7 deletions(-) create mode 100644 .changeset/no-tests-in-dist.md rename packages/core/{src/assets => tests}/semantic-contrast.test.ts (97%) rename packages/core/{src/assets => tests}/theme-bridge.test.ts (97%) diff --git a/.changeset/no-tests-in-dist.md b/.changeset/no-tests-in-dist.md new file mode 100644 index 000000000..f7c82aa96 --- /dev/null +++ b/.changeset/no-tests-in-dist.md @@ -0,0 +1,5 @@ +--- +"@tailor-platform/app-shell": patch +--- + +The published package no longer includes `dist/semantic-contrast.test.ts` and `dist/theme-bridge.test.ts`. These internal test files were copied into `dist/` by mistake. No public API or CSS changes. diff --git a/packages/core/src/assets/semantic-contrast.test.ts b/packages/core/tests/semantic-contrast.test.ts similarity index 97% rename from packages/core/src/assets/semantic-contrast.test.ts rename to packages/core/tests/semantic-contrast.test.ts index d5a667978..666dacb14 100644 --- a/packages/core/src/assets/semantic-contrast.test.ts +++ b/packages/core/tests/semantic-contrast.test.ts @@ -18,8 +18,11 @@ import { describe, expect, it } from "vitest"; * - the neutral intent, whose values are the pre-existing system tokens; * - the warning `solid` fill against the card (a fill, not a text pair). */ -const here = dirname(fileURLToPath(import.meta.url)); -const css = readFileSync(join(here, "themes/default.css"), "utf8").replace(/\/\*[\s\S]*?\*\//g, ""); +const assetsDir = join(dirname(fileURLToPath(import.meta.url)), "../src/assets"); +const css = readFileSync(join(assetsDir, "themes/default.css"), "utf8").replace( + /\/\*[\s\S]*?\*\//g, + "", +); type Rgba = { r: number; g: number; b: number; a: number }; type Mode = "light" | "dark"; diff --git a/packages/core/src/assets/theme-bridge.test.ts b/packages/core/tests/theme-bridge.test.ts similarity index 97% rename from packages/core/src/assets/theme-bridge.test.ts rename to packages/core/tests/theme-bridge.test.ts index 93f2273ff..785e89f83 100644 --- a/packages/core/src/assets/theme-bridge.test.ts +++ b/packages/core/tests/theme-bridge.test.ts @@ -10,9 +10,9 @@ import { describe, expect, it } from "vitest"; * bridge entry would leave every other test green while the utility silently * stops producing colour. */ -const here = dirname(fileURLToPath(import.meta.url)); -const bridge = readFileSync(join(here, "theme.bridge.css"), "utf8"); -const defaultTheme = readFileSync(join(here, "themes/default.css"), "utf8"); +const assetsDir = join(dirname(fileURLToPath(import.meta.url)), "../src/assets"); +const bridge = readFileSync(join(assetsDir, "theme.bridge.css"), "utf8"); +const defaultTheme = readFileSync(join(assetsDir, "themes/default.css"), "utf8"); /** Semantic colour roles: 5 intents x 8 roles, named `--{intent}-{role}`. */ const SEMANTIC_PREFIX = "(?:info|success|warning|danger|neutral)"; diff --git a/packages/core/tests/typography-compile.test.ts b/packages/core/tests/typography-compile.test.ts index 810c11ffa..580412d08 100644 --- a/packages/core/tests/typography-compile.test.ts +++ b/packages/core/tests/typography-compile.test.ts @@ -8,7 +8,7 @@ import { describe, expect, it } from "vitest"; /** * Compiles theme.bridge.css with Tailwind and checks the emitted utility rules. - * The string-level checks in src/assets/theme-bridge.test.ts confirm that the + * The string-level checks in tests/theme-bridge.test.ts confirm that the * bridge names the right variables. This test confirms that Tailwind turns those * entries into the four declarations a role needs, both for AppShell's own * prefixed build (`astw:`) and for a consumer's unprefixed build. diff --git a/packages/core/vitest.config.ts b/packages/core/vitest.config.ts index 1d6721344..ee899051e 100644 --- a/packages/core/vitest.config.ts +++ b/packages/core/vitest.config.ts @@ -1,5 +1,5 @@ import path from "node:path"; -import { defineConfig } from "vitest/config"; +import { configDefaults, defineConfig } from "vitest/config"; const coverageEnabled = process.env.CI === "true"; const projectDir = import.meta.dirname; @@ -10,6 +10,8 @@ export default defineConfig({ }, test: { environment: "happy-dom", + // `pnpm build` writes to dist/. Keep any test file there out of the run. + exclude: [...configDefaults.exclude, "dist/**"], typecheck: { enabled: true, }, From 0e96331cf0a158551ddaad33125afc726af8b59d Mon Sep 17 00:00:00 2001 From: Hiroki Uemura Date: Sun, 25 Oct 2026 21:43:10 +0900 Subject: [PATCH 2/2] fix(core): exclude test files from the published package `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 --- packages/core/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/core/package.json b/packages/core/package.json index b52342cee..dac98131c 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -23,6 +23,7 @@ }, "files": [ "dist/**", + "!dist/**/*.test.*", "skills/**" ], "type": "module",