Skip to content

Commit d2a7c8f

Browse files
author
Maxim Zaytsev
authored
Revert "Adding code coverage analysis for tasks (#17545)" (#17690)
This reverts commit a8dda62.
1 parent e611ad6 commit d2a7c8f

File tree

6 files changed

+1652
-1260
lines changed

6 files changed

+1652
-1260
lines changed

.nycrc.json

Lines changed: 0 additions & 16 deletions
This file was deleted.

ci/build-all-steps.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,6 @@ steps:
9999
displayName: Legacy tests with node 6
100100
condition: ne(variables['numTasks'], 0)
101101

102-
# Publish code coverage result
103-
- task: PublishCodeCoverageResults@1
104-
displayName: Publish Code Coverage Results
105-
inputs:
106-
codeCoverageTool: Cobertura
107-
summaryFileLocation: $(System.DefaultWorkingDirectory)/_build/coverage/*coverage.xml
108-
109102
# Only when building on Windows:
110103
- ${{ if eq(parameters.os, 'Windows_NT') }}:
111104

ci/build-single-steps.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,6 @@ steps:
5555
testRunTitle: Node 6 Test Results
5656
searchFolder: $(System.DefaultWorkingDirectory)/testresults
5757

58-
# Publish code coverage result
59-
- task: PublishCodeCoverageResults@1
60-
displayName: Publish Code Coverage Results
61-
inputs:
62-
codeCoverageTool: Cobertura
63-
summaryFileLocation: $(System.DefaultWorkingDirectory)/_build/coverage/*coverage.xml
64-
6558
# Stage tasks individually into the package directory
6659
- script: node ./ci/stage-package.js ${{ not(parameters.push) }} individually
6760
displayName: Stage tasks individually into the package directory

make.js

Lines changed: 4 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ var binPath = path.join(__dirname, 'node_modules', '.bin');
5252
var makeOptionsPath = path.join(__dirname, 'make-options.json');
5353
var gendocsPath = path.join(__dirname, '_gendocs');
5454
var packagePath = path.join(__dirname, '_package');
55-
var coverageTasksPath = path.join(buildPath, 'coverage');
5655

5756
var CLI = {};
5857

@@ -337,7 +336,7 @@ CLI.test = function(/** @type {{ suite: string; node: string; task: string }} */
337336
console.log('> copying ps test lib resources');
338337
mkdir('-p', path.join(buildTestsPath, 'lib'));
339338
matchCopy(path.join('**', '@(*.ps1|*.psm1)'), path.join(testsPath, 'lib'), path.join(buildTestsPath, 'lib'));
340-
cd('..');
339+
341340
var suiteType = argv.suite || 'L0';
342341
function runTaskTests(taskName) {
343342
banner('Testing: ' + taskName);
@@ -360,21 +359,15 @@ CLI.test = function(/** @type {{ suite: string; node: string; task: string }} */
360359
return;
361360
}
362361

363-
nodeVersions.forEach(function (nodeVersion, index) {
362+
nodeVersions.forEach(function (nodeVersion) {
364363
try {
365364

366365
nodeVersion = String(nodeVersion);
367366
banner('Run Mocha Suits for node ' + nodeVersion);
368367
// setup the version of node to run the tests
369368
util.installNode(nodeVersion);
370-
371-
if (nodeVersions.length - 1 === index) {
372-
run('nyc --report-dir ' + coverageTasksPath + ' mocha ' + testsSpec.join(' '), /*inheritStreams:*/true);
373-
renameCodeCoverageOutput(coverageTasksPath, taskName);
374-
}
375-
else {
376-
run('mocha ' + testsSpec.join(' '), /*inheritStreams:*/true);
377-
}
369+
370+
run('mocha ' + testsSpec.join(' '), /*inheritStreams:*/true);
378371
} catch (e) {
379372
console.error(e);
380373
process.exit(1);
@@ -393,16 +386,6 @@ CLI.test = function(/** @type {{ suite: string; node: string; task: string }} */
393386
}
394387
});
395388

396-
try {
397-
util.rm(path.join(coverageTasksPath, '*coverage-summary.json'));
398-
util.run(`nyc merge ${coverageTasksPath} ${path.join(coverageTasksPath, 'mergedcoverage.json')}`, true);
399-
util.rm(path.join(coverageTasksPath, '*-coverage.json'));
400-
util.run(`nyc report -t ${coverageTasksPath} --report-dir ${coverageTasksPath} --reporter=cobertura`, true);
401-
util.rm(path.join(coverageTasksPath, 'mergedcoverage.json'));
402-
} catch (e) {
403-
console.log('Error while generating coverage report')
404-
}
405-
406389
banner('Running common library tests');
407390
var commonLibPattern = path.join(buildTasksPath, 'Common', '*', 'Tests', suiteType + '.js');
408391
var specs = [];
@@ -431,22 +414,6 @@ CLI.test = function(/** @type {{ suite: string; node: string; task: string }} */
431414
}
432415
}
433416

434-
function renameCodeCoverageOutput(coveragePath, taskName) {
435-
if (!coveragePath) return;
436-
try {
437-
if (fs.existsSync(coveragePath)) {
438-
if (fs.existsSync(path.join(coveragePath, "coverage-final.json"))) {
439-
fs.renameSync(path.join(coveragePath, "coverage-final.json"), path.join(coveragePath, `${taskName}-coverage.json`));
440-
}
441-
if (fs.existsSync(path.join(coveragePath, "coverage-summary.json"))) {
442-
fs.renameSync(path.join(coveragePath, "coverage-summary.json"), path.join(coveragePath, `${taskName}-coverage-summary.json`));
443-
}
444-
}
445-
} catch (e) {
446-
console.log(e)
447-
}
448-
}
449-
450417
//
451418
// node make.js testLegacy
452419
// node make.js testLegacy --suite L0/XCode

0 commit comments

Comments
 (0)