-
-
Notifications
You must be signed in to change notification settings - Fork 790
tests: use vitest projects #4359
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
Conversation
needs: | ||
- main | ||
- bun | ||
- fastly | ||
- node | ||
- deno | ||
- workerd | ||
- lambda | ||
- lambda-edge |
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.
Only need to collect coverage from the main
, bun
, and deno
jobs as bun run test
will include coverage for the each of fastly
, node
, workerd
, lambda
, and lambda-edge
include: ['**/runtime-tests/fastly/**/(*.)+(test).+(ts|tsx)'], | ||
exclude: ['**/runtime-tests/fastly/vitest.config.ts'], | ||
coverage: { | ||
...config.test?.coverage, | ||
reportsDirectory: './coverage/raw/runtime-fastly', | ||
}, |
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.
Project configuration is simpler as test files are found relative to the vitest.config.ts
, while coverage
configuration remains in the root vitest.config.ts
], | ||
"scripts": { | ||
"test": "tsc --noEmit && vitest --run && vitest -c .vitest.config/jsx-runtime-default.ts --run && vitest -c .vitest.config/jsx-runtime-dom.ts --run", | ||
"test": "tsc --noEmit && vitest --run", |
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.
vitest --run
will run all projects, including all runtime tests.
The equivalent command for just the jsx runtime tests would be..
vitest --project jsx-runtime-default --project jsx-runtime-dom --run
}, | ||
pool: 'forks', | ||
projects: [ | ||
'./runtime-tests/*/vitest.config.ts', |
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.
This will lookup and run all the runtime tests
{ | ||
esbuild: { | ||
jsx: 'automatic', | ||
jsxImportSource: './src/jsx', | ||
}, | ||
extends: true, | ||
test: { | ||
environment: 'node', | ||
exclude: [...configDefaults.exclude, 'src/jsx', '**/*.case.test.*'], | ||
include: [ | ||
'src/**/(*.)+(spec|test).+(ts|tsx|js)', | ||
'scripts/**/(*.)+(spec|test).+(ts|tsx|js)', | ||
'build/**/(*.)+(spec|test).+(ts|tsx|js)', | ||
], | ||
name: 'unit', | ||
}, | ||
}, |
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.
This will run the same tests as what vitest --run
previously ran
{ | ||
esbuild: { | ||
jsx: 'automatic', | ||
jsxImportSource: './src/jsx', | ||
}, | ||
extends: true, | ||
test: { | ||
include: ['src/jsx/dom/**/(*.)+(spec|test).+(ts|tsx|js)', 'src/jsx/hooks/dom.test.tsx'], | ||
name: 'jsx-runtime-default', | ||
}, | ||
}, |
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.
This runs the same tests as what vitest -c .vitest.config/jsx-runtime-default.ts --run
previously ran
{ | ||
esbuild: { | ||
jsx: 'automatic', | ||
jsxImportSource: './src/jsx/dom', | ||
}, | ||
extends: true, | ||
test: { | ||
include: ['src/jsx/dom/**/(*.)+(spec|test).+(ts|tsx|js)', 'src/jsx/hooks/dom.test.tsx'], | ||
name: 'jsx-runtime-dom', | ||
}, | ||
}, |
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.
This runs the same tests as what vitest -c .vitest.config/jsx-runtime-dom.ts --run
previously ran
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4359 +/- ##
==========================================
- Coverage 91.34% 91.31% -0.04%
==========================================
Files 172 171 -1
Lines 10934 10894 -40
Branches 3134 3137 +3
==========================================
- Hits 9988 9948 -40
Misses 945 945
Partials 1 1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
dd8c281
to
34e48df
Compare
e578d60
to
d0f0511
Compare
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.
LGTM!
Awesome! This is a good improvement for the repo. Thanks! |
Using vitest projects to reduce the configuration required for tests