Page MenuHomePhabricator

Increase Vue coverage
Open, In Progress, LowPublic

Description

As we build more modules with Vue we would like to keep a minimum level of unit test coverage (tbd which number should that be). Currently there are 3 modules with Vue components with very few tests:

  1. modules/vue-components
  2. modules/ext.growthExperiments.MentorDashboard
  3. modules/ext.growthExperiments.Homepage.NewImpact

Event Timeline

Change 865062 had a related patch set uploaded (by Sergio Gimeno; author: Sergio Gimeno):

[mediawiki/extensions/GrowthExperiments@master] Vue components: refactor CText to use standard template

https://gerrit.wikimedia.org/r/865062

Change 865064 had a related patch set uploaded (by Sergio Gimeno; author: Sergio Gimeno):

[mediawiki/extensions/GrowthExperiments@master] Test NoEditsDisplay component

https://gerrit.wikimedia.org/r/865064

Reedy renamed this task from Increase coverage Vue coverage to Increase Vue coverage.Dec 6 2022, 1:07 PM
Reedy added a project: Test-Coverage.

Change 868129 had a related patch set uploaded (by Sergio Gimeno; author: Sergio Gimeno):

[mediawiki/extensions/GrowthExperiments@master] [WIP] Test ScoreCards component

https://gerrit.wikimedia.org/r/868129

Sgs changed the task status from Open to In Progress.Dec 15 2022, 12:07 PM
Sgs triaged this task as Low priority.

Change 865062 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] Vue components: refactor CText to use standard template

https://gerrit.wikimedia.org/r/865062

Change 865064 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] Test NoEditsDisplay component

https://gerrit.wikimedia.org/r/865064

Change 868129 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] Test ScoreCards component

https://gerrit.wikimedia.org/r/868129

Change 887977 had a related patch set uploaded (by Sergio Gimeno; author: Sergio Gimeno):

[mediawiki/extensions/GrowthExperiments@master] Vue components: test CPopper

https://gerrit.wikimedia.org/r/887977

Change 887977 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] Vue components: test CPopper

https://gerrit.wikimedia.org/r/887977

Anything else to do for this one? Should we set a specific percentage that we are targeting?

Change 936248 had a related patch set uploaded (by Sergio Gimeno; author: Sergio Gimeno):

[mediawiki/extensions/GrowthExperiments@master] [tests] Set a global coverage threshold for Vue files

https://gerrit.wikimedia.org/r/936248

Anything else to do for this one? Should we set a specific percentage that we are targeting?

Ideally we would pursue a near to full coverage, understanding that 100% unit coverage is not an indicator of code correctness but another code health metric. Since it might takes us some time to get close to that goal I think we should pursue it as part of our standard work stream rather than within a specific task. I've added coverage thresholds for both the Vue components in documentation/frontend and in modules/{vue-components,ext.growthExperiments.Homepage.NewImpact, ext.growthExperiments.MentorDashboard} so changes to Vue code that decrease the global coverage fail in CI. Hopefully this will motivate writing more unit tests for our Vue code. We can always adjust the threshold values in the config file if we need to merge a particular change that decreases global coverage.

Change 936248 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] [tests] Set a global coverage threshold for Vue files

https://gerrit.wikimedia.org/r/936248

We agreed with @Urbanecm to let the CI fail if the threshold is not met as an experiment to see if it improves our Vue unit test coverage. The idea is to measure if the CI fails due to not meeting the coverage engage contributors on writing more tests. If we feel the CI breaks to often due to this check without adding the metnioned value we can move the check to a non-voting job.