incremental-coverage
Advanced tools
Comparing version 2.4.1 to 2.4.2
@@ -38,7 +38,7 @@ "use strict"; | ||
this.format(); | ||
const firstInfo = this.firstInfo ? this.firstInfo : undefined; | ||
const createInfo = this.firstInfo ? this.firstInfo : undefined; | ||
if (this.opts.output) { | ||
this.output({ | ||
data: this.formatData, | ||
createInfo: firstInfo, | ||
createInfo, | ||
}); | ||
@@ -48,3 +48,4 @@ } | ||
data: this.formatData, | ||
createInfo: firstInfo, | ||
createInfo, | ||
gitRepoInfo: this.getGitRepoInfo() | ||
}; | ||
@@ -51,0 +52,0 @@ }); |
@@ -56,2 +56,3 @@ "use strict"; | ||
this.firstInfo = this.getCreateInfo(); | ||
const createInfo = this.firstInfo; | ||
yield this.getLcov(); | ||
@@ -63,3 +64,3 @@ this.format(); | ||
commit: this.firstGitMessage, | ||
createInfo: this.firstInfo, | ||
createInfo, | ||
}); | ||
@@ -70,3 +71,4 @@ } | ||
commit: this.firstGitMessage, | ||
createInfo: this.firstInfo, | ||
createInfo, | ||
gitRepoInfo: this.getGitRepoInfo() | ||
}; | ||
@@ -73,0 +75,0 @@ }); |
import { FileStreamOpt, StdoutStreamOpt } from '../../streams'; | ||
import { FirstCommitInfo, FormatData, FullResult, Lcov } from '../../types'; | ||
import { FirstCommitInfo, FormatData, FullResult, GitRepoInfo, Lcov } from '../../types'; | ||
export interface Mapper { | ||
@@ -25,4 +25,5 @@ stdio: StdoutStreamOpt; | ||
protected getCreateInfo(): FirstCommitInfo | undefined; | ||
protected getGitRepoInfo(): GitRepoInfo; | ||
} | ||
export * from './full'; | ||
export * from './increase'; |
@@ -67,2 +67,10 @@ "use strict"; | ||
} | ||
getGitRepoInfo() { | ||
const remoteUrl = git_1.getGitRepoRemoteUrl(this.opts.cwd); | ||
const branch = git_1.getGitRepoCurrentBranch(this.opts.cwd); | ||
return { | ||
remoteUrl, | ||
branch | ||
}; | ||
} | ||
} | ||
@@ -69,0 +77,0 @@ exports.BaseProcess = BaseProcess; |
@@ -51,2 +51,6 @@ export interface Total { | ||
} | ||
export interface GitRepoInfo { | ||
remoteUrl: string; | ||
branch: string; | ||
} | ||
export interface IncreaseResult { | ||
@@ -56,2 +60,3 @@ data: FormatData; | ||
createInfo: FirstCommitInfo; | ||
gitRepoInfo: GitRepoInfo; | ||
} | ||
@@ -61,2 +66,3 @@ export interface FullResult { | ||
createInfo?: FirstCommitInfo; | ||
gitRepoInfo: GitRepoInfo; | ||
} |
import { FirstCommitInfo } from "../types"; | ||
export declare function getGitRepoRemoteUrl(cwd?: string): string; | ||
export declare function getGitRepoCurrentBranch(cwd?: string): string; | ||
export declare function getGitRepoRootPath(cwd?: string): string; | ||
export declare function getGitRepoFirstCommitInfo(cwd?: string): FirstCommitInfo | undefined; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getGitRepoFirstCommitInfo = exports.getGitRepoRootPath = void 0; | ||
exports.getGitRepoFirstCommitInfo = exports.getGitRepoRootPath = exports.getGitRepoCurrentBranch = exports.getGitRepoRemoteUrl = void 0; | ||
const child_process_1 = require("child_process"); | ||
function getGitRepoRemoteUrl(cwd) { | ||
try { | ||
const res = child_process_1.execSync(`git remote -v`, { | ||
cwd: cwd || process.cwd(), | ||
}) | ||
.toString() | ||
.split('\n'); | ||
const matchResult = res[0].trim().match(/[^\s]*\s+(.*)\s+\(.*/i); | ||
return matchResult && matchResult[1] || ''; | ||
} | ||
catch (e) { | ||
return ''; | ||
} | ||
} | ||
exports.getGitRepoRemoteUrl = getGitRepoRemoteUrl; | ||
function getGitRepoCurrentBranch(cwd) { | ||
try { | ||
const res = child_process_1.execSync(`git symbolic-ref --short -q HEAD`, { | ||
cwd: cwd || process.cwd(), | ||
}) | ||
.toString() | ||
.split('\n'); | ||
return res[0]; | ||
} | ||
catch (e) { | ||
return ''; | ||
} | ||
} | ||
exports.getGitRepoCurrentBranch = getGitRepoCurrentBranch; | ||
function getGitRepoRootPath(cwd) { | ||
@@ -6,0 +35,0 @@ try { |
{ | ||
"name": "incremental-coverage", | ||
"version": "2.4.1", | ||
"version": "2.4.2", | ||
"description": "Merge lcov.info and get incremental coverage and full coverage", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3
57576
49
1279