Skip to content

Track graphql extensions as modules

Albert requested to merge 339344-track-graphql-jest into master

What does this MR do and why?

  1. Adds .graphql and .gql in jest config's moduleFileExtensions. This would include these files as modules in jest's filesystem and enables jest to resolve them as dependencies. In turn, it allows --findRelatedTests to find tests that have .gql and .graphql modules in the dependency list.
  2. Remove .graphql from excluded patterns for jest minimal jobs.

Screenshots or screen recordings

Before:

$ jest --config jest.config.js --listTests --findRelatedTests app/assets/javascripts/pipeline_editor/graphql/queries/available_branches.graphql

Done in 16.07s.

After:

$ jest --config jest.config.js --listTests --findRelatedTests app/assets/javascripts/pipeline_editor/graphql/queries/available_branches.graphql
spec/frontend/pipeline_editor/pipeline_editor_app_spec.js
spec/frontend/pipeline_editor/components/file-nav/branch_switcher_spec.js
spec/frontend/pipeline_editor/pipeline_editor_home_spec.js
spec/frontend/pipeline_editor/components/ui/pipeline_editor_empty_state_spec.js
spec/frontend/pipeline_editor/components/file-nav/pipeline_editor_file_nav_spec.js
Done in 20.84s.

How to set up and validate locally

Follow above examples using various .graphql files.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #339344 (closed)

Edited by Albert

Merge request reports