diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e9ab3f94..99fed354 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,8 +12,8 @@ jobs: matrix: node: [10, 12, 14, 16] steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 with: node-version: ${{ matrix.node }} - run: node --version @@ -30,8 +30,8 @@ jobs: windows: runs-on: windows-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 with: node-version: 12 - run: npm install diff --git a/package.json b/package.json index aac4004d..41e78816 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "private": true, "description": "monorepo containing the various nuts and bolts that facilitate istanbul.js test instrumentation", "scripts": { - "test": "cross-env NODE_ENV=test nyc mocha --timeout 30000 packages/*/test{,/*}.js", + "test": "cross-env NODE_ENV=test FORCE_COLOR=1 nyc mocha --timeout 30000 packages/{istanbul-reports/test/*/*,*/test/*}.js", "posttest": "eslint .", "fix": "eslint . --fix", "postinstall": "bash scripts/install.sh" diff --git a/packages/istanbul-lib-hook/test/data/bar.es6 b/packages/istanbul-lib-hook/test/data/bar.es6 index 08c4f076..ef3b5d10 100644 --- a/packages/istanbul-lib-hook/test/data/bar.es6 +++ b/packages/istanbul-lib-hook/test/data/bar.es6 @@ -1,4 +1,3 @@ module.exports = { bar: function () { return 'bar'; } }; - diff --git a/packages/istanbul-lib-hook/test/hook.test.js b/packages/istanbul-lib-hook/test/hook.test.js index 2ef0cf9b..193dc541 100644 --- a/packages/istanbul-lib-hook/test/hook.test.js +++ b/packages/istanbul-lib-hook/test/hook.test.js @@ -5,10 +5,10 @@ const hook = require('../lib/hook'); let currentHook; const matcher = function(file) { - return file.indexOf('foo.js') > 0; + return file.indexOf('foo.js') > -1; }; const matcher2 = function(file) { - return file.indexOf('bar.es6') > 0; + return file.indexOf('bar.es6') > -1; }; const transformer = function() { return 'module.exports.bar = function () { return "bar"; };'; @@ -42,6 +42,7 @@ describe('hooks', () => { it('transforms foo', () => { const foo = require('./data/foo'); + console.log('foo', foo); assert.ok(foo.bar); assert.equal(foo.bar(), 'bar'); }); diff --git a/packages/istanbul-reports/lcov.info b/packages/istanbul-reports/lcov.info new file mode 100644 index 00000000..7f627e05 --- /dev/null +++ b/packages/istanbul-reports/lcov.info @@ -0,0 +1,114 @@ +TN: +SF:test-exclude/index.js +FN:12,TestExclude +FN:50,(anonymous_1) +FN:52,(anonymous_2) +FN:61,(anonymous_3) +FN:71,(anonymous_4) +FN:84,prepGlobPatterns +FN:85,(anonymous_6) +FN:100,(anonymous_7) +FNF:8 +FNH:8 +FNDA:21,TestExclude +FNDA:21,(anonymous_1) +FNDA:95,(anonymous_2) +FNDA:56,(anonymous_3) +FNDA:7,(anonymous_4) +FNDA:26,prepGlobPatterns +FNDA:105,(anonymous_6) +FNDA:21,(anonymous_7) +DA:1,1 +DA:2,1 +DA:3,1 +DA:4,1 +DA:5,1 +DA:13,21 +DA:21,21 +DA:22,21 +DA:24,21 +DA:25,7 +DA:28,21 +DA:29,15 +DA:32,21 +DA:33,5 +DA:35,16 +DA:38,21 +DA:39,5 +DA:42,21 +DA:50,1 +DA:51,21 +DA:52,21 +DA:53,95 +DA:55,95 +DA:56,95 +DA:58,21 +DA:61,1 +DA:62,56 +DA:65,56 +DA:67,55 +DA:68,55 +DA:71,1 +DA:72,7 +DA:76,7 +DA:77,6 +DA:78,6 +DA:80,1 +DA:85,26 +DA:87,105 +DA:88,39 +DA:92,105 +DA:93,50 +DA:96,105 +DA:100,1 +DA:101,21 +DA:104,1 +DA:113,1 +LF:46 +LH:46 +BRDA:21,0,0,1 +BRDA:21,0,1,20 +BRDA:21,1,0,1 +BRDA:21,1,1,0 +BRDA:22,2,0,1 +BRDA:22,2,1,20 +BRDA:24,3,0,7 +BRDA:24,3,1,14 +BRDA:24,4,0,21 +BRDA:24,4,1,18 +BRDA:24,4,2,15 +BRDA:28,5,0,15 +BRDA:28,5,1,6 +BRDA:28,6,0,21 +BRDA:28,6,1,8 +BRDA:29,7,0,15 +BRDA:29,7,1,0 +BRDA:32,8,0,5 +BRDA:32,8,1,16 +BRDA:32,9,0,21 +BRDA:32,9,1,5 +BRDA:38,10,0,5 +BRDA:38,10,1,16 +BRDA:38,11,0,21 +BRDA:38,11,1,20 +BRDA:55,12,0,1 +BRDA:55,12,1,94 +BRDA:62,13,0,56 +BRDA:62,13,1,56 +BRDA:65,14,0,1 +BRDA:65,14,1,55 +BRDA:68,15,0,55 +BRDA:68,15,1,15 +BRDA:68,15,2,50 +BRDA:76,16,0,6 +BRDA:76,16,1,1 +BRDA:76,17,0,7 +BRDA:76,17,1,7 +BRDA:76,17,2,6 +BRDA:87,18,0,39 +BRDA:87,18,1,66 +BRDA:92,19,0,50 +BRDA:92,19,1,55 +BRF:43 +BRH:41 +end_of_record diff --git a/packages/istanbul-reports/lib/cobertura/index.js b/packages/istanbul-reports/lib/cobertura/index.js index e5574faa..54947d0a 100644 --- a/packages/istanbul-reports/lib/cobertura/index.js +++ b/packages/istanbul-reports/lib/cobertura/index.js @@ -60,7 +60,9 @@ class CoberturaReport extends ReportBase { return; } this.xml.openTag('package', { - name: node.isRoot() ? 'main' : escape(asJavaPackage(node)), + name: node.isRoot() + ? 'main' + : escape(asJavaPackage(node, this.projectRoot)), 'line-rate': metrics.lines.pct / 100.0, 'branch-rate': metrics.branches.pct / 100.0 }); @@ -90,7 +92,8 @@ class CoberturaReport extends ReportBase { this.xml.openTag('methods'); const fnMap = fileCoverage.fnMap; - Object.entries(fnMap).forEach(([k, { name, decl }]) => { + Object.entries(fnMap).forEach(([k, item]) => { + const { name, decl } = item; const hits = fileCoverage.f[k]; this.xml.openTag('method', { name: escape(name), @@ -136,9 +139,10 @@ class CoberturaReport extends ReportBase { } } -function asJavaPackage(node) { - return node - .getRelativeName() +function asJavaPackage(node, projectRoot) { + return node.path + .toString() + .replace(projectRoot, '') .replace(/\//g, '.') .replace(/\\/g, '.') .replace(/\.$/, ''); diff --git a/packages/istanbul-reports/test/cobertura/index.js b/packages/istanbul-reports/test/cobertura/index.js index 2a39fe86..42d3f32b 100644 --- a/packages/istanbul-reports/test/cobertura/index.js +++ b/packages/istanbul-reports/test/cobertura/index.js @@ -26,25 +26,29 @@ describe('CoberturaReport', () => { __dirname, '../fixtures/specs/' + file )); - it(fixture.title, function() { - if (isWindows()) { - // appveyor does not render console color. - return this.skip(); - } - const context = istanbulLibReport.createContext({ - dir: './', - coverageMap: istanbulLibCoverage.createCoverageMap(fixture.map) - }); - const tree = context.getTree('pkg'); - const report = new CoberturaReport({ - file: '-', - timestamp: '123456789', - ...fixture.opts + if (fixture.coberturaCoverageData) { + it(fixture.title, function() { + if (isWindows()) { + // appveyor does not render console color. + return this.skip(); + } + const context = istanbulLibReport.createContext({ + dir: './', + coverageMap: istanbulLibCoverage.createCoverageMap( + fixture.map + ) + }); + const tree = context.getTree('pkg'); + const report = new CoberturaReport({ + file: '-', + timestamp: '123456789', + ...fixture.opts + }); + tree.visit(report, context); + const output = FileWriter.getOutput(); + output.should.equal(fixture.coberturaCoverageData); }); - tree.visit(report, context); - const output = FileWriter.getOutput(); - output.should.equal(fixture.coberturaCoverageData); - }); + } } fs.readdirSync(path.resolve(__dirname, '../fixtures/specs')).forEach( diff --git a/packages/istanbul-reports/test/fixtures/specs/100-line-missing-branch.json b/packages/istanbul-reports/test/fixtures/specs/100-line-missing-branch.json index c0561a71..35b6b937 100644 --- a/packages/istanbul-reports/test/fixtures/specs/100-line-missing-branch.json +++ b/packages/istanbul-reports/test/fixtures/specs/100-line-missing-branch.json @@ -85,7 +85,7 @@ } ] }, - "coberturaCoverageData": "\n\n\n \n /Users/benjamincoe/oss/\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n", + "coberturaCoverageData": "\n\n\n \n /Users/benjamincoe/oss/\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n", "map": { "/Users/benjamincoe/oss/test-exclude/index.js": { "path": "/Users/benjamincoe/oss/test-exclude/index.js", diff --git a/packages/istanbul-reports/test/fixtures/specs/different-path-files.json b/packages/istanbul-reports/test/fixtures/specs/different-path-files.json index 15b64736..97844103 100644 --- a/packages/istanbul-reports/test/fixtures/specs/different-path-files.json +++ b/packages/istanbul-reports/test/fixtures/specs/different-path-files.json @@ -4,7 +4,7 @@ "maxCols": 80, "projectRoot": "/Users/jschmidle/oss/istanbuljs-test/" }, - "textReportExpected": "-------------------|---------|----------|---------|---------|-------------------\nFile | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s \n-------------------|---------|----------|---------|---------|-------------------\nAll files | 0 | 0 | 0 | 0 | \u001b[31;1m \u001b[0m \n istanbuljs-test | 0 | 0 | 0 | 0 | \u001b[31;1m \u001b[0m \n rootfile.js | 0 | 0 | 0 | 0 | \u001b[31;1m \u001b[0m \n ...-test/package1 | 0 | 0 | 0 | 0 | \u001b[31;1m \u001b[0m \n package1file.js | 0 | 0 | 0 | 0 | \u001b[31;1m \u001b[0m \n ...ge1/subpackage | 0 | 0 | 0 | 0 | \u001b[31;1m \u001b[0m \n ...ackagefile.js | 0 | 0 | 0 | 0 | \u001b[31;1m \u001b[0m \n ...-test/package2 | 0 | 0 | 0 | 0 | \u001b[31;1m \u001b[0m \n package2file.js | 0 | 0 | 0 | 0 | \u001b[31;1m \u001b[0m \n-------------------|---------|----------|---------|---------|-------------------\n", + "textReportExpected": "-------------------|---------|----------|---------|---------|-------------------\nFile | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s \n-------------------|---------|----------|---------|---------|-------------------\nAll files | 0 | 0 | 0 | 0 | \u001b[31;1m \u001b[0m \n src | 0 | 0 | 0 | 0 | \u001b[31;1m \u001b[0m \n rootfile.js | 0 | 0 | 0 | 0 | \u001b[31;1m \u001b[0m \n src/package1 | 0 | 0 | 0 | 0 | \u001b[31;1m \u001b[0m \n package1file.js | 0 | 0 | 0 | 0 | \u001b[31;1m \u001b[0m \n ...ge1/subpackage | 0 | 0 | 0 | 0 | \u001b[31;1m \u001b[0m \n ...ackagefile.js | 0 | 0 | 0 | 0 | \u001b[31;1m \u001b[0m \n src/package2 | 0 | 0 | 0 | 0 | \u001b[31;1m \u001b[0m \n package2file.js | 0 | 0 | 0 | 0 | \u001b[31;1m \u001b[0m \n-------------------|---------|----------|---------|---------|-------------------\n", "htmlSpaFiles": [ ["package1","package1file.js.html"], ["package1","subpackage","subpackagefile.js.html"], @@ -19,6 +19,7 @@ "statements": { "total": 0, "covered": 0, + "missed": 0, "skipped": 0, "pct": 0, "classForPercent": "empty" @@ -26,6 +27,7 @@ "branches": { "total": 0, "covered": 0, + "missed": 0, "skipped": 0, "pct": 0, "classForPercent": "empty" @@ -33,6 +35,7 @@ "functions": { "total": 0, "covered": 0, + "missed": 0, "skipped": 0, "pct": 0, "classForPercent": "empty" @@ -40,6 +43,7 @@ "lines": { "total": 0, "covered": 0, + "missed": 0, "skipped": 0, "pct": 0, "classForPercent": "empty" @@ -53,6 +57,7 @@ "statements": { "total": 0, "covered": 0, + "missed": 0, "skipped": 0, "pct": 0, "classForPercent": "empty" @@ -60,6 +65,7 @@ "branches": { "total": 0, "covered": 0, + "missed": 0, "skipped": 0, "pct": 0, "classForPercent": "empty" @@ -67,6 +73,7 @@ "functions": { "total": 0, "covered": 0, + "missed": 0, "skipped": 0, "pct": 0, "classForPercent": "empty" @@ -74,6 +81,7 @@ "lines": { "total": 0, "covered": 0, + "missed": 0, "skipped": 0, "pct": 0, "classForPercent": "empty" @@ -87,6 +95,7 @@ "statements": { "total": 0, "covered": 0, + "missed": 0, "skipped": 0, "pct": 0, "classForPercent": "empty" @@ -94,6 +103,7 @@ "branches": { "total": 0, "covered": 0, + "missed": 0, "skipped": 0, "pct": 0, "classForPercent": "empty" @@ -101,6 +111,7 @@ "functions": { "total": 0, "covered": 0, + "missed": 0, "skipped": 0, "pct": 0, "classForPercent": "empty" @@ -108,6 +119,7 @@ "lines": { "total": 0, "covered": 0, + "missed": 0, "skipped": 0, "pct": 0, "classForPercent": "empty" @@ -122,6 +134,7 @@ "statements": { "total": 0, "covered": 0, + "missed": 0, "skipped": 0, "pct": 0, "classForPercent": "empty" @@ -129,6 +142,7 @@ "branches": { "total": 0, "covered": 0, + "missed": 0, "skipped": 0, "pct": 0, "classForPercent": "empty" @@ -136,6 +150,7 @@ "functions": { "total": 0, "covered": 0, + "missed": 0, "skipped": 0, "pct": 0, "classForPercent": "empty" @@ -143,6 +158,7 @@ "lines": { "total": 0, "covered": 0, + "missed": 0, "skipped": 0, "pct": 0, "classForPercent": "empty" @@ -156,6 +172,7 @@ "statements": { "total": 0, "covered": 0, + "missed": 0, "skipped": 0, "pct": 0, "classForPercent": "empty" @@ -163,6 +180,7 @@ "branches": { "total": 0, "covered": 0, + "missed": 0, "skipped": 0, "pct": 0, "classForPercent": "empty" @@ -170,6 +188,7 @@ "functions": { "total": 0, "covered": 0, + "missed": 0, "skipped": 0, "pct": 0, "classForPercent": "empty" @@ -177,6 +196,7 @@ "lines": { "total": 0, "covered": 0, + "missed": 0, "skipped": 0, "pct": 0, "classForPercent": "empty" @@ -195,6 +215,7 @@ "statements": { "total": 0, "covered": 0, + "missed": 0, "skipped": 0, "pct": 0, "classForPercent": "empty" @@ -202,6 +223,7 @@ "branches": { "total": 0, "covered": 0, + "missed": 0, "skipped": 0, "pct": 0, "classForPercent": "empty" @@ -209,6 +231,7 @@ "functions": { "total": 0, "covered": 0, + "missed": 0, "skipped": 0, "pct": 0, "classForPercent": "empty" @@ -216,6 +239,7 @@ "lines": { "total": 0, "covered": 0, + "missed": 0, "skipped": 0, "pct": 0, "classForPercent": "empty" @@ -229,6 +253,7 @@ "statements": { "total": 0, "covered": 0, + "missed": 0, "skipped": 0, "pct": 0, "classForPercent": "empty" @@ -236,6 +261,7 @@ "branches": { "total": 0, "covered": 0, + "missed": 0, "skipped": 0, "pct": 0, "classForPercent": "empty" @@ -243,6 +269,7 @@ "functions": { "total": 0, "covered": 0, + "missed": 0, "skipped": 0, "pct": 0, "classForPercent": "empty" @@ -250,6 +277,7 @@ "lines": { "total": 0, "covered": 0, + "missed": 0, "skipped": 0, "pct": 0, "classForPercent": "empty" @@ -266,6 +294,7 @@ "statements": { "total": 0, "covered": 0, + "missed": 0, "skipped": 0, "pct": 0, "classForPercent": "empty" @@ -273,6 +302,7 @@ "branches": { "total": 0, "covered": 0, + "missed": 0, "skipped": 0, "pct": 0, "classForPercent": "empty" @@ -280,6 +310,7 @@ "functions": { "total": 0, "covered": 0, + "missed": 0, "skipped": 0, "pct": 0, "classForPercent": "empty" @@ -287,6 +318,7 @@ "lines": { "total": 0, "covered": 0, + "missed": 0, "skipped": 0, "pct": 0, "classForPercent": "empty" @@ -296,10 +328,10 @@ } ] }, - "coberturaCoverageData": "\n\n\n \n /Users/jschmidle/oss/istanbuljs-test/\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n", + "coberturaCoverageData": "\n\n\n \n /Users/jschmidle/oss/istanbuljs-test/\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n", "map": { - "/Users/jschmidle/oss/istanbuljs-test/rootfile.js": { - "path": "/Users/jschmidle/oss/istanbuljs-test/rootfile.js", + "/Users/jschmidle/oss/istanbuljs-test/src/rootfile.js": { + "path": "/Users/jschmidle/oss/istanbuljs-test/src/rootfile.js", "statementMap": {}, "fnMap": {}, "branchMap": {}, @@ -307,8 +339,8 @@ "f": {}, "b": {} }, - "/Users/jschmidle/oss/istanbuljs-test/package1/package1file.js": { - "path": "/Users/jschmidle/oss/istanbuljs-test/package1/package1file.js", + "/Users/jschmidle/oss/istanbuljs-test/src/package1/package1file.js": { + "path": "/Users/jschmidle/oss/istanbuljs-test/src/package1/package1file.js", "statementMap": {}, "fnMap": {}, "branchMap": {}, @@ -316,8 +348,8 @@ "f": {}, "b": {} }, - "/Users/jschmidle/oss/istanbuljs-test/package2/package2file.js": { - "path": "/Users/jschmidle/oss/istanbuljs-test/package2/package2file.js", + "/Users/jschmidle/oss/istanbuljs-test/src/package2/package2file.js": { + "path": "/Users/jschmidle/oss/istanbuljs-test/src/package2/package2file.js", "statementMap": {}, "fnMap": {}, "branchMap": {}, @@ -325,8 +357,8 @@ "f": {}, "b": {} }, - "/Users/jschmidle/oss/istanbuljs-test/package1/subpackage/subpackagefile.js": { - "path": "/Users/jschmidle/oss/istanbuljs-test/package1/subpackage/subpackagefile.js", + "/Users/jschmidle/oss/istanbuljs-test/src/package1/subpackage/subpackagefile.js": { + "path": "/Users/jschmidle/oss/istanbuljs-test/src/package1/subpackage/subpackagefile.js", "statementMap": {}, "fnMap": {}, "branchMap": {}, diff --git a/packages/istanbul-reports/test/fixtures/specs/missing-decl.json b/packages/istanbul-reports/test/fixtures/specs/missing-decl.json index 1a90f56f..c7fab93c 100644 --- a/packages/istanbul-reports/test/fixtures/specs/missing-decl.json +++ b/packages/istanbul-reports/test/fixtures/specs/missing-decl.json @@ -1,6 +1,10 @@ { - "title": "100% line coverage, missing branch coverage", + "title": "missing declaration", "textReportExpected": "----------|---------|----------|---------|---------|-------------------\nFile | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s \n----------|---------|----------|---------|---------|-------------------\n\u001b[32;1mAll files\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 95.34\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[33;1m \u001b[0m \n\u001b[32;1m index.js\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 95.34\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[32;1m 100\u001b[0m | \u001b[33;1m21,29 \u001b[0m \n----------|---------|----------|---------|---------|-------------------\n", + "opts": { + "maxCols": 80, + "projectRoot": "/Users/benjamincoe/oss/" + }, "lcovonlyExpected": "TN:\nSF:\nFN:12,TestExclude\nFN:50,(anonymous_1)\nFN:52,(anonymous_2)\nFN:61,(anonymous_3)\nFN:71,(anonymous_4)\nFN:84,prepGlobPatterns\nFN:85,(anonymous_6)\nFN:100,(anonymous_7)\nFNF:8\nFNH:8\nFNDA:21,TestExclude\nFNDA:21,(anonymous_1)\nFNDA:95,(anonymous_2)\nFNDA:56,(anonymous_3)\nFNDA:7,(anonymous_4)\nFNDA:26,prepGlobPatterns\nFNDA:105,(anonymous_6)\nFNDA:21,(anonymous_7)\nDA:1,1\nDA:2,1\nDA:3,1\nDA:4,1\nDA:5,1\nDA:13,21\nDA:21,21\nDA:22,21\nDA:24,21\nDA:25,7\nDA:28,21\nDA:29,15\nDA:32,21\nDA:33,5\nDA:35,16\nDA:38,21\nDA:39,5\nDA:42,21\nDA:50,1\nDA:51,21\nDA:52,21\nDA:53,95\nDA:55,95\nDA:56,95\nDA:58,21\nDA:61,1\nDA:62,56\nDA:65,56\nDA:67,55\nDA:68,55\nDA:71,1\nDA:72,7\nDA:76,7\nDA:77,6\nDA:78,6\nDA:80,1\nDA:85,26\nDA:87,105\nDA:88,39\nDA:92,105\nDA:93,50\nDA:96,105\nDA:100,1\nDA:101,21\nDA:104,1\nDA:113,1\nLF:46\nLH:46\nBRDA:21,0,0,1\nBRDA:21,0,1,20\nBRDA:21,1,0,1\nBRDA:21,1,1,0\nBRDA:22,2,0,1\nBRDA:22,2,1,20\nBRDA:24,3,0,7\nBRDA:24,3,1,14\nBRDA:24,4,0,21\nBRDA:24,4,1,18\nBRDA:24,4,2,15\nBRDA:28,5,0,15\nBRDA:28,5,1,6\nBRDA:28,6,0,21\nBRDA:28,6,1,8\nBRDA:29,7,0,15\nBRDA:29,7,1,0\nBRDA:32,8,0,5\nBRDA:32,8,1,16\nBRDA:32,9,0,21\nBRDA:32,9,1,5\nBRDA:38,10,0,5\nBRDA:38,10,1,16\nBRDA:38,11,0,21\nBRDA:38,11,1,20\nBRDA:55,12,0,1\nBRDA:55,12,1,94\nBRDA:62,13,0,56\nBRDA:62,13,1,56\nBRDA:65,14,0,1\nBRDA:65,14,1,55\nBRDA:68,15,0,55\nBRDA:68,15,1,15\nBRDA:68,15,2,50\nBRDA:76,16,0,6\nBRDA:76,16,1,1\nBRDA:76,17,0,7\nBRDA:76,17,1,7\nBRDA:76,17,2,6\nBRDA:87,18,0,39\nBRDA:87,18,1,66\nBRDA:92,19,0,50\nBRDA:92,19,1,55\nBRF:43\nBRH:41\nend_of_record\n", "htmlSpaFiles": ["index.js.html", "index.html"], "htmlSpaCoverageData": { diff --git a/packages/istanbul-reports/test/fixtures/specs/missing-line-missing-branch.json b/packages/istanbul-reports/test/fixtures/specs/missing-line-missing-branch.json index db2e18da..f163fa20 100644 --- a/packages/istanbul-reports/test/fixtures/specs/missing-line-missing-branch.json +++ b/packages/istanbul-reports/test/fixtures/specs/missing-line-missing-branch.json @@ -85,7 +85,7 @@ } ] }, - "coberturaCoverageData": "\n\n\n \n /Users/benjamincoe/oss\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n", + "coberturaCoverageData": "\n\n\n \n /Users/benjamincoe/oss\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n", "map": { "/Users/benjamincoe/oss/test-exclude/index.js": { "path": "/Users/benjamincoe/oss/test-exclude/index.js", diff --git a/packages/istanbul-reports/test/lcovonly/index.js b/packages/istanbul-reports/test/lcovonly/index.js index 70abdbfb..4babca83 100644 --- a/packages/istanbul-reports/test/lcovonly/index.js +++ b/packages/istanbul-reports/test/lcovonly/index.js @@ -26,23 +26,30 @@ describe('LcovOnlyReport', () => { __dirname, '../fixtures/specs/' + file )); - it(fixture.title, function() { - if (isWindows()) { - // appveyor does not render console color. - return this.skip(); - } - const context = istanbulLibReport.createContext({ - dir: './', - coverageMap: istanbulLibCoverage.createCoverageMap(fixture.map) - }); - const tree = context.getTree('pkg'); - const report = new LcovOnlyReport(fixture.opts); - tree.visit(report, context); - const output = FileWriter.getOutput().replace(/SF:.*/, 'SF:'); - if (fixture.lcovonlyExpected) { + if (fixture.lcovonlyExpected) { + it(fixture.title, function() { + if (isWindows()) { + // appveyor does not render console color. + return this.skip(); + } + const context = istanbulLibReport.createContext({ + dir: './', + coverageMap: istanbulLibCoverage.createCoverageMap( + fixture.map + ) + }); + const tree = context.getTree('pkg'); + const report = new LcovOnlyReport({ + file: '-', + timestamp: '123456789', + ...fixture.opts + }); + tree.visit(report, context); + const content = FileWriter.getOutput(); + const output = content.replace(/SF:.*/, 'SF:'); output.should.equal(fixture.lcovonlyExpected); - } - }); + }); + } } fs.readdirSync(path.resolve(__dirname, '../fixtures/specs')).forEach(