Skip to content

Run markdown_snapshot_spec.js when needed

Chad Woolley requested to merge caw-glfm-ci-triggers into master

What does this MR do and why?

Related: Tracking Issue: Implement GLFM scripts per the ... (#361241)

Implements suggestion from !102244 (comment 1150751210) to ensure spec/frontend/content_editor/markdown_snapshot_spec.js runs when GLFM config files are changed.

See this comment for details of this approach: !102244 (comment 1152326733)

Also adds yml extension to moduleFileExtensions in jest.config.base.js. This is necessary for jest's --findRelatedTests logic to properly recognize yml files as dependencies.

This increases the total number of dependencies slightly, but will prevent other occurrences of this same problem happening (imports relying on transform of yml files not being detected in dependencies). Here's the diffs in the number of entries in the HasteFS entry Jest uses to represent the list of dependencies:

117979 with yml
113271 without yml

Note that with the completion of Run jest full jobs in merge request pipelines a... (#379174 - closed), it will be less likely that missing running a jest spec results in a broken master.

However, this MR will help make sure that developers get earlier warning of failures rather than only finding out once the MR is approved and ready for merge, thus triggering a full jest run.

References

See the GLFM Specification Guide development documentation for much more context on all of this work: https://docs.gitlab.com/ee/development/gitlab_flavored_markdown/specification_guide

Testing

  • This was tested from command line via yarn jest spec/frontend --findRelatedTests glfm_specification/input/gitlab_flavored_markdown/glfm_example_status.yml --passWithNoTests, to ensure the moduleFileExtensions change works. Otherwise it relies on existing logic for the jest minimal CI job.

MR acceptance checklist

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

Edited by Chad Woolley

Merge request reports