-
-
Notifications
You must be signed in to change notification settings - Fork 183
docs(guides): add vitest integration example #937
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
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #937 +/- ##
==========================================
+ Coverage 90.76% 90.85% +0.09%
==========================================
Files 15 15
Lines 2035 2035
Branches 513 513
==========================================
+ Hits 1847 1849 +2
+ Misses 188 175 -13
- Partials 0 11 +11 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Thanks for adding a integration example for vitest. Please note that i have not used vitest yet.
(DISCLAIMER: I'm the author of the package, I can drop it if that's an issue)
No problem, just as noted below, please update with a little description.
## vitest | ||
|
||
For [vitest](https://vitest.dev/), create a [global setup file](https://vitest.dev/config/#globalsetup). |
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.
Please add a badge similar to jest and mocha:
<span class="badge badge--secondary">jest version 29</span> |
}); | ||
``` | ||
|
||
See also [vitest-mms](https://github.com/danielpza/vitest-mms) |
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.
Instead of just a simple see also
, could you add a simple explanation on why this should be a see also
, like a little description of what this package is doing / can be used for?
}); | ||
``` | ||
|
||
See also [vitest-mms](https://github.com/danielpza/vitest-mms) |
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.
Please add a note similar to jests tests and global setup do not share a environment
:
mongodb-memory-server/docs/guides/integration-examples/test-runners.md
Lines 102 to 104 in e4992fd
:::note | |
Keep in mind that jest's global-setup and global-teardown do **not** share a environment with the tests themself, and so require `setupFile` / `setupFilesAfterEnv` to actually connect. | |
::: |
re:
Beware that the global setup is running in a different global scope, so your tests don't have access to variables defined here. However, you can pass down serializable data to tests via provide method:
Source: the warning
`globalSetup.ts`: | ||
|
||
```ts | ||
import type { TestProject } from 'vitest/node'; |
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.
Import for mongodb-memory-server
missing?
Added vitest integration example
Also linked to the https://github.com/danielpza/vitest-mms package which aims to make it easier to setup up mongodb-memory-server with vitest (DISCLAIMER: I'm the author of the package, I can drop it if that's an issue)