mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-03 09:32:20 -05:00
Use monocart for coverage reports, enable codecov (#58850)
This commit is contained in:
@@ -32,7 +32,7 @@ export const coverageDir = "coverage";
|
||||
* @param {boolean} [options.watching]
|
||||
*/
|
||||
export async function runConsoleTests(runJs, defaultReporter, runInParallel, options = {}) {
|
||||
const testTimeout = cmdLineOptions.timeout;
|
||||
let testTimeout = cmdLineOptions.timeout;
|
||||
const tests = cmdLineOptions.tests;
|
||||
const skipSysTests = cmdLineOptions.skipSysTests;
|
||||
const inspect = cmdLineOptions.break || cmdLineOptions.inspect;
|
||||
@@ -45,6 +45,12 @@ export async function runConsoleTests(runJs, defaultReporter, runInParallel, opt
|
||||
const shards = +cmdLineOptions.shards || undefined;
|
||||
const shardId = +cmdLineOptions.shardId || undefined;
|
||||
const coverage = cmdLineOptions.coverage;
|
||||
|
||||
if (coverage && testTimeout) {
|
||||
testTimeout *= 2;
|
||||
console.log(chalk.yellowBright(`[coverage] doubling test timeout to ${testTimeout}ms...`));
|
||||
}
|
||||
|
||||
if (!cmdLineOptions.dirty) {
|
||||
if (options.watching) {
|
||||
console.log(chalk.yellowBright(`[watch] cleaning test directories...`));
|
||||
@@ -142,9 +148,14 @@ export async function runConsoleTests(runJs, defaultReporter, runInParallel, opt
|
||||
process.env.NODE_V8_COVERAGE = path.resolve(coverageDir, "tmp");
|
||||
}
|
||||
|
||||
await exec(process.execPath, args, { token: options.token });
|
||||
if (coverage) {
|
||||
await exec("npm", ["--prefer-offline", "exec", "--", "c8", "report"], { token: options.token });
|
||||
try {
|
||||
await exec(process.execPath, args, { token: options.token });
|
||||
}
|
||||
finally {
|
||||
// Calculate coverage even if tests failed.
|
||||
if (coverage) {
|
||||
await exec("npm", ["--prefer-offline", "exec", "--", "c8", "report", "--experimental-monocart"], { token: options.token });
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user