Intelligent Test Runner for JavaScript and TypeScript

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.
  • mocha>=5.2.0
    • From dd-trace>=3.16.0 or dd-trace>=2.29.0.
    • Run mocha with nyc to enable code coverage.
  • cucumber-js>=7.0.0
    • From dd-trace>=3.16.0 or dd-trace>=2.29.0.
    • Run cucumber-js with nyc to enable code coverage.

Setup

Prior to setting up Intelligent Test Runner, set up Test Visibility for Javascript and Typescript. If you are reporting data through the Agent, use v6.40+/v7.40+.

To enable Intelligent Test Runner, set the following environment variables:

DD_APPLICATION_KEY (Required)
The Datadog Application key used to query the tests to be skipped.
Default: (empty)

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=true DD_API_KEY=$API_KEY DD_APPLICATION_KEY=$APP_KEY yarn test

UI activation

In addition to setting the environment variables, 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.

Intelligent test runner enabled in test service settings in the CI section of Datadog.

Suite skipping

Intelligent test runner for Javascript skips entire test suites (test files) rather than individual tests.

Further Reading

Documentation, liens et articles supplémentaires utiles: