/build-and-test-close-the-deal

Datadog test vis setup with JS

Primary LanguageJavaScript

Close the deal exercise

1. Test Visibility

Find how to setup this project.

Fork repository

First thing is to fork this repository:

For the repository

It's important that you fork into the DataDog namespace. Choose a name like build-and-test-close-the-deal-$YOUR_NAME.

Keep the repository page open in a tab at all times.

Set DD_API_KEY as secret in your repository.

Follow the in app onboarding

  • Go to https://app.datadoghq.com/ci/setup/test and follow the instructions.
  • Do not select the type of CI provider we're using.
  • Test framework: Jest.
  • Write your DD_ENV: use something that identifies you, such as "test-juan".
  • Set DD_SERVICE to close-the-deal-tests.

Enable Intelligent Test Runner

Enable GitHub PR comments

  • Activate the toggle.
  • Click on "Save".

Enable Early Flake Detection

  • Activate the toggle.
  • Select "main" as default branch.

Change your GHA workflow

  • Scroll up to the "Run your tests" section.
  • Copy the snippet of code at the right side.
  • Go to test.yml and substitute the "Run tests" step's current command by the snippet.
  • IMPORTANT: Make sure you are not committing any API Key.
  • Commit directly to main.

See results in Datadog

2. Intelligent Test Runner

We're going to test Intelligent Test Runner's capability to skip tests by modifying a file that's used by a single test.

  • Modify array.js by uncommenting the line following the comment in calculateAverage.
  • Commit changes in a different branch from the default branch. You can use feature-branch-itr or something similar.
  • See Intelligent Test Runner savings in the branch page.

3. Early Flake Detection

We're going to test Early Flake Detection's capability to detect flakiness early.

  • Modify array.test.js by uncommenting the last test
  • Commit changes in a different branch from the default branch. You can use feature-branch-efd or something similar.
  • See flakiness being detected in the branch page.