Skip to content

Commit

Permalink
added type tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shairez committed Dec 3, 2024
1 parent 7a98c2c commit 1308ccb
Show file tree
Hide file tree
Showing 5 changed files with 333 additions and 224 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@
"@types/node": "20.12.12",
"@typescript-eslint/eslint-plugin": "7.9.0",
"@typescript-eslint/parser": "7.9.0",
"@vitest/coverage-v8": "^1.6.0",
"@vitest/ui": "^1.6.0",
"@vitest/coverage-v8": "^2.1.8",
"@vitest/ui": "^2.1.8",
"ansis": "3.2.0",
"autoprefixer": "^10.4.19",
"axe-core": "^4.9.1",
Expand Down Expand Up @@ -135,7 +135,7 @@
"vite-plugin-inspect": "^0.8.4",
"vite-plugin-static-copy": "1.0.4",
"vite-tsconfig-paths": "4.3.2",
"vitest": "^1.6.0",
"vitest": "^2.1.8",
"wrangler": "^3.57.1",
"yargs": "^17.7.2"
},
Expand Down
8 changes: 8 additions & 0 deletions packages/kit-styled/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@
"production": {}
}
},
"test": {
"executor": "@nx/vite:test",
"outputs": ["{workspaceRoot}/coverage/packages/kit-styled"],
"options": {
"passWithNoTests": true,
"reportsDirectory": "../../coverage/packages/kit-styled"
}
},
"lint": {
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"],
Expand Down
16 changes: 16 additions & 0 deletions packages/kit-styled/src/components/select/select.test-d.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { test, expectTypeOf } from 'vitest';
import { Select } from './select';
test('Styled Select Types', () => {
<Select.Root
onChange$={(value) => {
expectTypeOf(value).toMatchTypeOf<string>();
}}
/>;

<Select.Root
multiple
onChange$={(value) => {
expectTypeOf(value).toMatchTypeOf<string[]>();
}}
/>;
});
2 changes: 1 addition & 1 deletion packages/kit-styled/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ export default defineConfig({
globals: true,
cache: { dir: '../../node_modules/.vitest' },
environment: 'node',
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
include: ['src/**/*.{spec,test-d}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
},
});
Loading

0 comments on commit 1308ccb

Please sign in to comment.