Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

ci: typecheck lab, charts, rich text and Vega with their tests, like core (#8318)

Christopher Chedeau0a9814aa7c51
diff --git a/.github/scripts/ci-test-routing.test.mjs b/.github/scripts/ci-test-routing.test.mjs
index 3f98eef8df..d5cc531118 100644
--- a/.github/scripts/ci-test-routing.test.mjs
+++ b/.github/scripts/ci-test-routing.test.mjs
@@ -531,6 +531,30 @@ describe('ci.yml RTL package sharding', () => {
});
});
+describe('full component typechecks', () => {
+ // Each component package's own sources and tests, in both typecheck lanes:
+ // typecheck:docs covers only its .doc.mjs files, so a type error in a test
+ // otherwise lands on main unseen (lab's MobileTokenizer.test.tsx did).
+ const packages = ['core', 'lab', 'charts', 'richtext', 'vega'];
+
+ it.each(['ci.yml', 'deploy.yml'])(
+ '%s typechecks every component package, tests included',
+ file => {
+ const steps = load(file).jobs.typecheck.steps;
+ const command = name => `pnpm -F @astryxdesign/${name} typecheck`;
+ const core = steps.find(step => step.run === command('core'));
+ for (const name of packages) {
+ const step = steps.find(candidate => candidate.run === command(name));
+ expect(step, `${file} does not typecheck ${name}`).toBeDefined();
+ // The same specialized-lane guard as core's (none in deploy.yml).
+ expect(step.if, `${file}: ${name} is not guarded like core`).toBe(
+ core.if,
+ );
+ }
+ },
+ );
+});
+
describe('deploy.yml push gating', () => {
const workflow = load('deploy.yml');
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 29929cd25a..062c415cfa 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -1229,6 +1229,24 @@ jobs:
if: needs.check-scope.outputs.docsite_only != 'true' && needs.check-scope.outputs.spec_only != 'true' && needs.check-scope.outputs.tooling_only != 'true'
run: pnpm -F @astryxdesign/core typecheck
+ # The other component packages' own sources and tests, like core's: their
+ # typecheck:docs steps above cover only their .doc.mjs files.
+ - name: Typecheck lab (including tests)
+ if: needs.check-scope.outputs.docsite_only != 'true' && needs.check-scope.outputs.spec_only != 'true' && needs.check-scope.outputs.tooling_only != 'true'
+ run: pnpm -F @astryxdesign/lab typecheck
+
+ - name: Typecheck charts (including tests)
+ if: needs.check-scope.outputs.docsite_only != 'true' && needs.check-scope.outputs.spec_only != 'true' && needs.check-scope.outputs.tooling_only != 'true'
+ run: pnpm -F @astryxdesign/charts typecheck
+
+ - name: Typecheck rich text (including tests)
+ if: needs.check-scope.outputs.docsite_only != 'true' && needs.check-scope.outputs.spec_only != 'true' && needs.check-scope.outputs.tooling_only != 'true'
+ run: pnpm -F @astryxdesign/richtext typecheck
+
+ - name: Typecheck Vega (including tests)
+ if: needs.check-scope.outputs.docsite_only != 'true' && needs.check-scope.outputs.spec_only != 'true' && needs.check-scope.outputs.tooling_only != 'true'
+ run: pnpm -F @astryxdesign/vega typecheck
+
# The accessibility spec-test contracts are consumed as TypeScript source
# by Vitest and Playwright, and neither runner typechecks. This is the
# only gate over them.
diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index 3eaee6914b..698440caaf 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -126,6 +126,20 @@ jobs:
- name: Typecheck core (including tests)
run: pnpm -F @astryxdesign/core typecheck
+ # The other component packages' own sources and tests, like core's: their
+ # typecheck:docs gates above cover only their .doc.mjs files.
+ - name: Typecheck lab (including tests)
+ run: pnpm -F @astryxdesign/lab typecheck
+
+ - name: Typecheck charts (including tests)
+ run: pnpm -F @astryxdesign/charts typecheck
+
+ - name: Typecheck rich text (including tests)
+ run: pnpm -F @astryxdesign/richtext typecheck
+
+ - name: Typecheck Vega (including tests)
+ run: pnpm -F @astryxdesign/vega typecheck
+
# The accessibility spec-test contracts are consumed as TypeScript source
# by Vitest and Playwright, and neither runner typechecks. This is the
# only gate over them.
diff --git a/packages/lab/src/MobileTokenizer/MobileTokenizer.test.tsx b/packages/lab/src/MobileTokenizer/MobileTokenizer.test.tsx
index 0a531a39a4..38cc47ce9c 100644
--- a/packages/lab/src/MobileTokenizer/MobileTokenizer.test.tsx
+++ b/packages/lab/src/MobileTokenizer/MobileTokenizer.test.tsx
@@ -56,7 +56,14 @@ function Harness({
);
}
-function CreateHarness({spy}: {spy: ReturnType<typeof vi.fn>}) {
+function CreateHarness({
+ spy,
+}: {
+ spy: (
+ items: SearchableItem[],
+ change: MobileTokenizerChange<SearchableItem>,
+ ) => void;
+}) {
const [value, setValue] = useState<SearchableItem[]>([]);
return (
<MobileTokenizer