Page MenuHomePhabricator

Improve Javascript test coverage to >=85% and enforce same for future patches
Closed, ResolvedPublic

Description

We would generally like to have >=85% coverage on lines, functions, branches, and statements in both Python and Javascript code. Current Javascript failure thresholds for coverage are set lower than this so that tests pass with legacy code with weak test coverage:

  • ✅ lines: 85
  • ✅ functions: 85
  • branches: 75
  • ✅ statements: 85

Certain files like swagger.js and i18n/index.js have little to no test coverage.

Event Timeline

bd808 renamed this task from Improve Test Coverage to Improve Javascript test coverage to >=85% and enforce same for future patches.Jan 29 2022, 12:11 AM
bd808 triaged this task as Medium priority.
bd808 updated the task description. (Show Details)
bd808 moved this task from Backlog to Groomed/Ready on the Toolhub board.

@bd808 and @Slst2020 our .vue files are currently exporting methods, but we are not testing any of those. What is our stand on this? since there are many of such functions, I think it makes sense to test those too. What does the team think about this?

@bd808 and @Slst2020 our .vue files are currently exporting methods, but we are not testing any of those. What is our stand on this? since there are many of such functions, I think it makes sense to test those too. What does the team think about this?

I think it can make sense when there are methods in the .vue files which are actually contain testable business logic. I don't think there is a lot of value in testing methods that only add configuration (like data() or computed methods which are used for configuration) or trivially wrap a call to vuex.

Change 766204 had a related patch set uploaded (by BryanDavis; author: Bryan Davis):

[wikimedia/toolhub@main] ui: Increase test coverage

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

Change 766204 merged by jenkins-bot:

[wikimedia/toolhub@main] ui: Increase test coverage

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

Change 770638 had a related patch set uploaded (by BryanDavis; author: Bryan Davis):

[operations/deployment-charts@master] toolhub: Bump container version to 2022-03-15-002555-production

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

Change 770638 merged by jenkins-bot:

[operations/deployment-charts@master] toolhub: Bump container version to 2022-03-15-002555-production

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

Change 862407 had a related patch set uploaded (by BryanDavis; author: Bryan Davis):

[wikimedia/toolhub@main] ui: Increase test coverage

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

bd808 changed the task status from Open to In Progress.Dec 1 2022, 3:59 AM
bd808 claimed this task.
bd808 moved this task from Groomed/Ready to Review on the Toolhub board.

Change 862407 merged by jenkins-bot:

[wikimedia/toolhub@main] ui: Increase test coverage

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