Cette page n'est pas encore disponible en français, sa traduction est en cours. Si vous avez des questions ou des retours sur notre projet de traduction actuel, n'hésitez pas à nous contacter.
Compatibility
Intelligent Test Runner is only supported in the following versions and testing frameworks:
jest>=24.8.0
From dd-trace>=3.16.0 or dd-trace>=2.29.0.
Only jest-circus/runner is supported as testRunner.
Only jsdom and node are supported as test environments.
You, or a user in your organization with “Intelligent Test Runner Activation” permissions, must activate the Intelligent Test Runner on the Test Service Settings page.
Application key and permissions
The Intelligent Test Runner requires an application key mapped to an owner role with the CI Visibility Read (ci_visibility_read) permission.
After setting these environment variables, run your tests as you normally do:
NODE_OPTIONS="-r dd-trace/ci/init"DD_ENV=ci DD_SERVICE=my-javascript-app DD_CIVISIBILITY_AGENTLESS_ENABLED=trueDD_API_KEY=$DD_API_KEYDD_APPLICATION_KEY=$DD_APPLICATION_KEY yarn test
Cypress setup
For Intelligent Test Runner for Cypress to work, you must instrument your web application with code coverage. You can read more about enabling code coverage in the Cypress documentation. To check that you’ve successfully enabled code coverage, navigate to your web app with Cypress and check the global variable window.__coverage__. This is what dd-trace uses to collect code coverage for Intelligent Test Runner.
Suite skipping
Intelligent Test Runner for Javascript skips entire test suites (test files) rather than individual tests.
Inconsistent test durations
In some frameworks, such as jest, there are cache mechanisms that make tests faster after other tests have run (see jest cache docs). If Intelligent Test Runner is skipping all but a few test files, these suites might run slower than they usually do. This is because they run with a colder cache. Regardless of this, total execution time for your test command should still be reduced.
Further Reading
Documentation, liens et articles supplémentaires utiles: