Export merged results of unit and interaction test coverage as text file

For convenience, since the bots will still use the JSON file.

Also, an option to define the folders on which coverage will be
calculated is added to the interaction tests. The flag works
identically to the COVERAGE_FOLDERS of unit tests, i.e. a pattern is
provided to define the included folders. For example: the flag can be
set like COVERAGE_FOLDERS=
front_end/{models/trace,models/timeline_model,panels/timeline}

These two changes should help to calculate the total OPP coverage in
go/opp-test-coverage

Bug: 1424729
Change-Id: Ie982f62dfac0014c05075e53173a8e7710d3b9e0
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/4345493
Commit-Queue: Andres Olivares <andoli@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
This commit is contained in:
Andrés Olivares
2023-03-20 09:39:59 +00:00
committed by Devtools-frontend LUCI CQ
parent f567b83f3c
commit 10417e7ccb
4 changed files with 12 additions and 1 deletions
+8
View File
@@ -14,6 +14,8 @@ const defaultIstanbulSchema = require('@istanbuljs/schema');
const {getTestRunnerConfigSetting} = require('../test/test_config_helpers.js');
const match = require('minimatch');
const serverPort = parseInt(process.env.PORT, 10) || 8090;
const target = argv.target || process.env.TARGET || 'Default';
@@ -200,6 +202,8 @@ async function checkFileExists(filePath) {
const EXCLUDED_COVERAGE_FOLDERS = new Set(['third_party', 'ui/components/docs', 'Images']);
const USER_DEFINED_COVERAGE_FOLDERS = process.env['COVERAGE_FOLDERS'];
/**
* @param {string} filePath
* @returns {boolean}
@@ -210,6 +214,10 @@ function isIncludedForCoverageComputation(filePath) {
return false;
}
}
if (USER_DEFINED_COVERAGE_FOLDERS) {
const matchPattern = `/${USER_DEFINED_COVERAGE_FOLDERS}/**/*.{js,mjs}`;
return match(filePath, matchPattern);
}
return true;
}
+1
View File
@@ -17,3 +17,4 @@ const context = report.createContext({
defaultSummarizer: 'nested',
});
reports.create('json-summary').execute(context);
reports.create('text', {file: 'coverage.txt'}).execute(context);
+2 -1
View File
@@ -1 +1,2 @@
coverage-summary.json
coverage-summary.json
coverage.txt
+1
View File
@@ -103,6 +103,7 @@ export const mochaHooks = {
});
reports.create('html').execute(context);
reports.create('json').execute(context);
reports.create('text', {file: 'coverage.txt'}).execute(context);
reports.create('json-summary').execute(context);
},
// In both modes, run before each test.