Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

incremental-coverage

Package Overview
Dependencies
Maintainers
2
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

incremental-coverage - npm Package Compare versions

Comparing version 2.4.0 to 2.4.1

lib/utils/git.d.ts

6

lib/apis/lcovConcat.js

@@ -20,2 +20,3 @@ "use strict";

const readLcov_1 = require("../utils/readLcov");
const utils_1 = require("../utils");
function lcovConcat(lcovPath) {

@@ -31,2 +32,3 @@ return __awaiter(this, void 0, void 0, function* () {

const res = yield readLcov_1.getLcovFile(lcovPath);
const cwd = utils_1.getActualGitRepoRoot(opts.cwd);
let { hash } = opts;

@@ -38,3 +40,3 @@ if (!hash) {

const logRes = yield new parsers_1.LogParser({
repo: opts.cwd,
repo: cwd,
until: subDate,

@@ -46,3 +48,3 @@ }).run();

return (yield new concat_1.IncreaseConcat({
cwd: opts.cwd,
cwd,
hash,

@@ -49,0 +51,0 @@ }).concat(...res)).getRes();

@@ -16,2 +16,3 @@ "use strict";

const readLcov_1 = require("../../utils/readLcov");
const utils_1 = require("../../utils");
class FullProcess extends index_1.BaseProcess {

@@ -26,3 +27,3 @@ constructor(lcovPath, opts = { stream: {} }) {

}
this.opts.cwd = opts.cwd || process.cwd();
this.opts.cwd = utils_1.getActualGitRepoRoot(opts.cwd);
this.opts.stream.name = opts.stream.name || 'file';

@@ -34,9 +35,12 @@ this.opts.stream.opts = opts.stream.opts;

return __awaiter(this, void 0, void 0, function* () {
this.createInfo();
if (this.opts.cwd) {
this.firstInfo = this.getCreateInfo();
}
yield this.getLcov();
this.format();
const firstInfo = this.firstInfo ? this.firstInfo : undefined;
if (this.opts.output) {
this.output({
data: this.formatData,
createInfo: this.firstInfo,
createInfo: firstInfo,
});

@@ -46,3 +50,3 @@ }

data: this.formatData,
createInfo: this.firstInfo,
createInfo: firstInfo,
};

@@ -49,0 +53,0 @@ });

@@ -22,2 +22,3 @@ "use strict";

const readLcov_1 = require("../../utils/readLcov");
const utils_1 = require("../../utils");
class IncreaseProcess extends index_1.BaseProcess {

@@ -37,3 +38,3 @@ constructor(lcovPath, opts = { stream: {} }) {

const startDay = dayjs_1.default().startOf('month').format('YYYY-MM-DD');
this.opts.cwd = opts.cwd || process.cwd();
this.opts.cwd = utils_1.getActualGitRepoRoot(opts.cwd);
this.opts.since = opts.since || startDay;

@@ -53,3 +54,6 @@ this.opts.stream.name = opts.stream.name || 'file';

}
this.createInfo();
if (!this.opts.cwd) {
throw new Error('must pass a git dir');
}
this.firstInfo = this.getCreateInfo();
yield this.getLcov();

@@ -56,0 +60,0 @@ this.format();

import { FileStreamOpt, StdoutStreamOpt } from '../../streams';
import { FirstInfo, FormatData, FullResult, Lcov } from '../../types';
import { FirstCommitInfo, FormatData, FullResult, Lcov } from '../../types';
export interface Mapper {

@@ -20,9 +20,9 @@ stdio: StdoutStreamOpt;

protected formatData: FormatData;
protected firstInfo: FirstInfo | undefined;
protected firstInfo: FirstCommitInfo | undefined;
abstract exec(): Promise<FullResult>;
protected format(): void;
protected output(data: unknown): void;
protected createInfo(): void;
protected getCreateInfo(): FirstCommitInfo | undefined;
}
export * from './full';
export * from './increase';

@@ -14,4 +14,4 @@ "use strict";

exports.BaseProcess = void 0;
const child_process_1 = require("child_process");
const streams_1 = require("../../streams");
const git_1 = require("../../utils/git");
class BaseProcess {

@@ -65,17 +65,4 @@ constructor() {

}
createInfo() {
const res = child_process_1.execSync('git log --reverse --pretty="%H!!!%h!!!%aN!!!%aE!!!%ad!!!%B"', {
cwd: this.opts.cwd,
})
.toString()
.split('\n');
const first = res[0].split('!!!');
this.firstInfo = {
hash: first[0],
abbrevHash: first[1],
authorName: first[2],
authorEmail: first[3],
authorDate: first[4],
subject: first[5],
};
getCreateInfo() {
return git_1.getGitRepoFirstCommitInfo(this.opts.cwd);
}

@@ -82,0 +69,0 @@ }

@@ -19,2 +19,3 @@ "use strict";

const parsers_1 = require("../parsers");
const utils_1 = require("../utils");
class IncreaseConcat {

@@ -31,3 +32,3 @@ constructor(opts = {}) {

this.diffData = [];
this.opts.cwd = opts.cwd || process.cwd();
this.opts.cwd = utils_1.getActualGitRepoRoot(opts.cwd);
this.opts.hash = opts.hash;

@@ -34,0 +35,0 @@ }

@@ -43,3 +43,3 @@ export interface Total {

}
export interface FirstInfo {
export interface FirstCommitInfo {
hash?: string;

@@ -55,7 +55,7 @@ abbrevHash?: string;

commit: CommitBase;
createInfo: FirstInfo;
createInfo: FirstCommitInfo;
}
export interface FullResult {
data: FormatData;
createInfo: FirstInfo;
createInfo?: FirstCommitInfo;
}
{
"name": "incremental-coverage",
"version": "2.4.0",
"description": "",
"version": "2.4.1",
"description": "Merge lcov.info and get incremental coverage and full coverage",
"main": "lib/index.js",

@@ -24,4 +24,7 @@ "bin": {

],
"keywords": [],
"author": "wangjq4214",
"keywords": [
"coverage",
"incremental-coverage"
],
"author": "helinjiang",
"license": "MIT",

@@ -28,0 +31,0 @@ "dependencies": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc