diff --git a/coverage-config.yaml b/coverage-config.yaml index dcf2268..13e2090 100644 --- a/coverage-config.yaml +++ b/coverage-config.yaml @@ -1,65 +1,50 @@ projects: - "zowe/perf-timing": - unit: - junit-artifact: perf-timing.yml/ubuntu-latest-18.x-results/unit/junit - lcov-artifact: perf-timing.yml/ubuntu-latest-18.x-results/unit/coverage - "zowe/imperative": - unit: - junit-artifact: imperative.yml/ubuntu-latest-18.x-results/unit/junit - lcov-artifact: imperative.yml/ubuntu-latest-18.x-results/unit/coverage - integration: - junit-artifact: imperative.yml/ubuntu-latest-18.x-results/integration/junit - system: - test-count: npm-jest "zowe/zowe-cli": unit: - junit-artifact: zowe-cli.yml/ubuntu-latest-18.x-results/unit - lcov-artifact: zowe-cli.yml/ubuntu-latest-18.x-results/unit/coverage + junit-artifact: zowe-cli.yml/ubuntu-latest-20.x-results/unit + lcov-artifact: zowe-cli.yml/ubuntu-latest-20.x-results/unit/coverage integration: - junit-artifact: zowe-cli.yml/ubuntu-latest-18.x-results/integration + junit-artifact: zowe-cli.yml/ubuntu-latest-20.x-results/integration system: test-count: npm-jest - "zowe/zowe-cli-cics-plugin": - unit: - junit-artifact: zowe-cli-plugin.yml/ubuntu-latest-18.x-results/unit - lcov-artifact: zowe-cli-plugin.yml/ubuntu-latest-18.x-results/unit/coverage + "zowe/cics-for-zowe-client#main": + unit-cli: + junit-artifact: main.yml/ubuntu-latest-20.x-results/cli/__tests__/__results__/unit + lcov-artifact: main.yml/ubuntu-latest-20.x-results/cli/__tests__/__results__/unit/coverage + unit-sdk: + junit-artifact: main.yml/ubuntu-latest-20.x-results/sdk/__tests__/__results__/unit + lcov-artifact: main.yml/ubuntu-latest-20.x-results/sdk/__tests__/__results__/unit/coverage + unit-vsce: + junit-artifact: main.yml/ubuntu-latest-20.x-results/vsce/__tests__/__results__/unit system: - test-count: npm-jest + test-count: npm-jest:packages/cli:packages/sdk "zowe/zowe-cli-db2-plugin": unit: - junit-artifact: zowe-cli-plugin.yml/ubuntu-latest-18.x-results/unit - lcov-artifact: zowe-cli-plugin.yml/ubuntu-latest-18.x-results/unit/coverage + junit-artifact: zowe-cli-plugin.yml/ubuntu-latest-20.x-results/unit + lcov-artifact: zowe-cli-plugin.yml/ubuntu-latest-20.x-results/unit/coverage system: test-count: npm-jest "zowe/zowe-cli-ftp-plugin": unit: - junit-artifact: zowe-cli-plugin.yml/ubuntu-latest-18.x-results/unit - lcov-artifact: zowe-cli-plugin.yml/ubuntu-latest-18.x-results/unit/coverage - system: - test-count: npm-jest - "zowe/zowe-cli-ims-plugin": - unit: - junit-artifact: zowe-cli-plugin.yml/ubuntu-latest-18.x-results/unit - lcov-artifact: zowe-cli-plugin.yml/ubuntu-latest-18.x-results/unit/coverage - integration: - junit-artifact: zowe-cli-plugin.yml/ubuntu-latest-18.x-results/integration + junit-artifact: zowe-cli-plugin.yml/ubuntu-latest-20.x-results/unit + lcov-artifact: zowe-cli-plugin.yml/ubuntu-latest-20.x-results/unit/coverage system: test-count: npm-jest "zowe/zowe-cli-mq-plugin": unit: - junit-artifact: zowe-cli-plugin.yml/ubuntu-latest-18.x-results/unit - lcov-artifact: zowe-cli-plugin.yml/ubuntu-latest-18.x-results/unit/coverage + junit-artifact: zowe-cli-plugin.yml/ubuntu-latest-20.x-results/unit + lcov-artifact: zowe-cli-plugin.yml/ubuntu-latest-20.x-results/unit/coverage integration: - junit-artifact: zowe-cli-plugin.yml/ubuntu-latest-18.x-results/integration + junit-artifact: zowe-cli-plugin.yml/ubuntu-latest-20.x-results/integration system: test-count: npm-jest "zowe/zowe-cli-scs-plugin": unit: - junit-artifact: zowe-cli-plugin.yml/ubuntu-latest-18.x-results/unit - lcov-artifact: zowe-cli-plugin.yml/ubuntu-latest-18.x-results/unit/coverage + junit-artifact: zowe-cli-plugin.yml/ubuntu-latest-20.x-results/unit + lcov-artifact: zowe-cli-plugin.yml/ubuntu-latest-20.x-results/unit/coverage system: test-count: npm-jest - "zowe/vscode-extension-for-zowe#main": + "zowe/zowe-explorer-vscode#main": unit: junit-artifact: zowe-explorer-ci.yml/zowe-explorer-results/unit lcov-artifact: zowe-explorer-ci.yml/zowe-explorer-results/unit/coverage diff --git a/scripts/coverage-report.js b/scripts/coverage-report.js index 1487e72..7a6e614 100644 --- a/scripts/coverage-report.js +++ b/scripts/coverage-report.js @@ -103,14 +103,17 @@ async function checkLcovArtifact(repo, type, workflow, artifact, dirname) { return { lineCoverage, hitLines, foundLines, branchCoverage, hitBranches, foundBranches }; }; -async function checkTestCount(repo, type, tools) { +async function checkTestCount(repo, type, tools, ...subDirs) { const tempDir = await gitCloneDir(repo); await exec.exec("npm", ["install", "--ignore-scripts", "--silent"], { cwd: tempDir }); - const output = await exec.getExecOutput("npm", ["run", `test:${type}`, "--", "--listTests"], { cwd: tempDir }); let numTests = 0; - for (const testFile of output.stdout.trim().split("\n").filter(line => line.includes(tempDir))) { - const testContents = stripComments(fs.readFileSync(testFile, "utf-8")); - numTests += (testContents.match(/\bit\(/g) || []).length; + for (const subDir of (subDirs.length ? subDirs : [""])) { + const output = await exec.getExecOutput("npm", ["run", `test:${type}`, "--", "--listTests"], + { cwd: path.join(tempDir, subDir) }); + for (const testFile of output.stdout.trim().split("\n").filter(line => line.includes(tempDir))) { + const testContents = stripComments(fs.readFileSync(testFile, "utf-8")); + numTests += (testContents.match(/\bit\(/g) || []).length; + } } return { numTests }; }; @@ -132,7 +135,7 @@ async function checkTestCount(repo, type, tools) { covData = { ...covData, ...await checkLcovArtifact(repoName, testType, ...splitAndAppend(covConfig, "/", 3)) }; break; case "test-count": - covData = { ...covData, ...await checkTestCount(repoName, testType, covConfig) }; + covData = { ...covData, ...await checkTestCount(repoName, testType, ...covConfig.split(":")) }; break; default: throw new Error("Unsupported coverage type " + covType);