Skip to content

Run jest related tests on CI on frontend changes

Albert requested to merge alberts-jest-related-tests into master

What does this MR do?

Run jest related tests in jest minimal jobs on CI on frontend changes MR before it is approved. Issue: #339342 (closed)

Prior to an MR approval, if the MR changes any frontend code, the jest minimal jobs in CI would run jest with --findRelatedTests option (jest doc). This would find and run the tests that cover the source files that have changed.

After an MR is approved, the pipeline would run the full jest suite.

There are a few cases where CI would run the full jest suite:

  • package.json and yarn.lock were changed
  • jest or babel config was changed
  • vendored javascript was changed
  • .graphql files were changed

This is a part of the larger plan: #337411 (closed)

Verifications

Scenario Result Example pipeline
frontend code change - before approval jest minimal jobs created https://gitlab.com/gitlab-org/gitlab/-/pipelines/364637740/builds
frontend code change - after approval jest jobs created https://gitlab.com/gitlab-org/gitlab/-/pipelines/365651114/builds
CI change (this MR) jest jobs created https://gitlab.com/gitlab-org/gitlab/-/pipelines/365627605/builds
run all jest label jest jobs created https://gitlab.com/gitlab-org/gitlab/-/pipelines/365639417/builds
Core changes (yarn.lock/package.json) jest jobs created https://gitlab.com/gitlab-org/gitlab/-/pipelines/365634072/builds
graphql changes jest jobs created https://gitlab.com/gitlab-org/gitlab/-/pipelines/365635661/builds
Edited by Albert

Merge request reports