dd-trace-js
dd-trace-js copied to clipboard
vitest support for CI
vitest is a new test framework similar to Jest that runs on top of Vite.
It would be great if dd-trace-js could instrument vitest similar to how the Jest integration works.
+1 on the request please.
👍 on this one
🙏
:+1: vitest is gaining more and more traction as a replacement of jest. We recently-ish had to switch away from jest because of performance issues and vitest was the easiest/simplest switch. Now that we're starting to look into datadog CI integration, I really wished there was native support for vitest
Today I was wondering "why did my tests stop showing up in Datadog" and I realized it is because I haven't published a repo that uses jest in several weeks. All my most recent code is using vitest. It is basically a must for the Vue framework and the support for module syntax is superior. And performance. So fast
I am an every day Datadog user. This will not stop me from using Datadog but I will not be able to make full use of CI. Using vitest is more necessary to my workflow than seeing it in Datadog
adding another comment here to request support. is there any traction on this front that can be surfaced here?
hi everyone! Good news: this is currently being worked on in https://github.com/DataDog/dd-trace-js/pull/4415. It's still going to take a bit but vitest support is coming 😄
🎉 🚢 vitest support is now released in
- https://github.com/DataDog/dd-trace-js/releases/tag/v5.18.0
- https://github.com/DataDog/dd-trace-js/releases/tag/v4.42.0
until we update the docs with the instructions, here's how you can try the vitest integration:
npm install --save-dev dd-trace
Make sure the dd-trace installed version is >=5.18.0 or >=4.42.0.
Then run your vitest tests passing NODE_OPTIONS='--import dd-trace/register.js -r dd-trace/ci/init'.
⚠️ Important:
- It needs an extra parameter when compared to running tests with
mocha,jestor other supported test frameworks:--import dd-trace/register.js - The minimum supported Node.js versions are >=18.19 and >=20.6
For example, if your package.json looks like:
"scripts": {
"test": "vitest run"
}
Run
NODE_OPTIONS='--import dd-trace/register.js -r dd-trace/ci/init' DD_SERVICE=your-javascript-app-tests npm run test
Take into account that you'll still need an API key or a running agent (see docs for more info)