Automatically instrument Jest tests for open telemetry.
Install @dagger.io/jest in your project
npm install @dagger.io/jestYou can either follow a no-configuration setup or update your current jest.config.js file.
Add the following import in your NODE_OPTIONS to auto-instrument when running your test
"NODE_OPTIONS=\"$NODE_OPTIONS --register @dagger.io/jest/register \" jest💡 If your project is in ESM, make sure you first followed ECMAScript Module setup on Jest
The library export an environment that you can use to automatically instrument your tests:
testEnvironment: "@dagger.io/jest/node-environment"