Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 470
test(ui): Add Vitest with in-source testing#4012
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Uh oh!
There was an error while loading. Please reload this page.
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -8,9 +8,9 @@ | ||
| "importHelpers": true, | ||
| "isolatedModules": true, | ||
| "jsx": "react-jsx", | ||
| "lib": ["es2021.intl", "dom"], | ||
| "module": "NodeNext", | ||
| "moduleResolution": "NodeNext", | ||
| "lib": ["es6", "es2021.intl", "dom"], | ||
MemberAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not completely sure why this wasn't causing errors before, but our | ||
| "module": "es2020", | ||
| "moduleResolution": "Bundler", | ||
MemberAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TypeScript complained about | ||
| "noImplicitReturns": true, | ||
| "noUnusedLocals": true, | ||
| "noUnusedParameters": true, | ||
| @@ -23,7 +23,7 @@ | ||
| "paths": { | ||
| "~/*": ["src/*"] | ||
| }, | ||
| "typeRoots": ["../../node_modules/@types", "./src/types"] | ||
| "types": ["vitest/importMeta"] | ||
MemberAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This adds the global types for | ||
| }, | ||
| "include": ["src"] | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -40,6 +40,7 @@ export default defineConfig(overrideOptions => { | ||
| PACKAGE_NAME: `"${name}"`, | ||
| PACKAGE_VERSION: `"${version}"`, | ||
| __DEV__: `${!isProd}`, | ||
| 'import.meta.vitest': 'undefined', | ||
MemberAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Defining this to | ||
| }, | ||
| dts: true, | ||
| entry: { | ||
| @@ -52,5 +53,6 @@ export default defineConfig(overrideOptions => { | ||
| minify: false, | ||
| sourcemap: true, | ||
| esbuildPlugins: [tailwindcssTransformerCode], | ||
| treeshake: true, | ||
MemberAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This enables rollup's tree shaking instead of just relying on the limited tree shaking built into esbuild. | ||
| }; | ||
| }); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| import { defineConfig } from 'vitest/config'; | ||
| export default defineConfig({ | ||
| test: { | ||
| includeSource: ['**/*.{js,ts,jsx,tsx}'], | ||
| alias: { | ||
| '~/': new URL('./src/', import.meta.url).pathname, | ||
| }, | ||
| }, | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fancy ✨