add jest coverage in js coverage report

refs DE-989
flag=none

TEST PLAN:
  confirm https://code-coverage.inseng.net/ is updated with new report

Previous versions of the JS coverage report we not including jest
tests, so this tweak adds them

Change-Id: Ic780ab9df0ab97eaf3d49cda5c6dbc8cebbb7607
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/288044
Reviewed-by: James Butters <jbutters@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Bobby Buten <bobby.buten@instructure.com>
Product-Review: Bobby Buten <bobby.buten@instructure.com>
This commit is contained in:
Bobby Buten 2022-03-25 07:53:52 -04:00
parent a935e17425
commit 6c56e38559
4 changed files with 16 additions and 2 deletions

View File

@ -165,6 +165,9 @@ pipeline {
extendedStage('Parallel Run Tests').obeysAllowStages(false).execute { stageConfig, buildConfig ->
def jsStages = [:]
// increate node count for coverage
jsStage.JEST_NODE_COUNT = 4
for (int i = 0; i < jsStage.JEST_NODE_COUNT; i++) {
String index = i
extendedStage("Runner - Jest ${i}").nodeRequirements(label: 'canvas-docker', podTemplate: jsStage.jestNodeRequirementsTemplate(index)).obeysAllowStages(false).timeout(10).queue(jsStages) {

View File

@ -110,7 +110,7 @@ def queueJestDistribution(index) {
'CI=1',
]
callableWithDelegate(queueTestStage())(stages, "jest${index}", jestEnvVars, 'bundle exec rails graphql:schema && yarn test:jest')
callableWithDelegate(queueTestStage())(stages, "jest${index}", jestEnvVars, 'bundle exec rails graphql:schema && yarn test:jest:build')
}
}

View File

@ -59,6 +59,16 @@ module.exports = {
coverageDirectory: '<rootDir>/coverage-jest/',
// skip flaky timeout tests from coverage until they can be addressed
// Related JIRA tickets for the skipped coverage tests;
// k5_dashboard: LS-2243
// discussion_topics_post: VICE-2646
collectCoverageFrom: [
'**/__tests__/**/?(*.)(spec|test).[jt]s?(x)',
'!<rootDir>/ui/features/k5_dashboard/react/__tests__/k5DashboardPlanner.test.js',
'!<rootDir>/ui/features/discussion_topics_post/react/__tests__/DiscussionsIsolatedView.test.js'
],
moduleFileExtensions: [...defaults.moduleFileExtensions, 'coffee', 'handlebars'],
restoreMocks: true,

View File

@ -360,9 +360,10 @@
"test:coverage": "script/generate_js_coverage",
"test:watch": "concurrently --names \"jest,karma\" \"jest --watch .\" \"yarn test:karma:watch\"",
"test:jest": "jest --color",
"test:jest:coverage": "NODE_OPTIONS=\"--max_old_space_size=8192\" jest --color --coverage",
"test:jest:coverage": "NODE_OPTIONS=\"--max_old_space_size=8192\" jest --color --coverage --testTimeout=30000",
"test:jest:debug": "node --inspect-brk node_modules/.bin/jest --runInBand",
"test:jest:watch": "jest --color --watch",
"test:jest:build": "if [ \"$COVERAGE\" = \"1\" ]; then yarn test:jest:coverage; else yarn test:jest; fi",
"test:karma": "yarn run test:karma:watch --single-run",
"test:karma:concurrently": "concurrently --names \"coffee,jsa,jsg,jsh\" \"JSPEC_GROUP=coffee yarn test:karma:headless\" \"JSPEC_GROUP=jsa yarn test:karma:headless\" \"JSPEC_GROUP=jsg yarn test:karma:headless\" \"JSPEC_GROUP=jsh yarn test:karma:headless\"",
"test:karma:headless": "yarn run test:karma --browsers ChromeHeadlessNoSandbox",