stryker-git-checker
Version:
Git Checker for Stryker Mutator Javascript testing framework
38 lines • 1.45 kB
TypeScript
export declare enum ChunkLinePrefix {
UNCHANGED = " ",
ADDITION = "+",
DELETION = "-"
}
export declare type LineDifferenceRange = [number, number];
export declare type DiffMap = Map<string, Map<number, LineDifferenceRange>>;
/**
* Compares the deleted and the added line present
* in the diff chunk, returning the range of the comparison
* in the `[left, right]` format. The right is exclusive and
* the left is inclusive.
*
* The algorithm is a simple heuristic to remove the start and
* the end of the lines if they are respectively the same.
*
* @param deleted The line that was deleted in the diff.
* @param added The line that was added in the diff.
* @returns The difference range if exists.
*/
export declare function compareLine(deleted: string | undefined, added: string): LineDifferenceRange | undefined;
/**
* Parses a diff chunk.
*
* @param chunk chunk string.
* @param startLinePosition the correspondent position of the first line.
* @returns Range entries.
*/
export declare function parseChunk(chunk: string, startLinePosition: number): [number, LineDifferenceRange][];
/**
* Parses the output of the `git diff` command.
*
* @param input the stdout of the `git diff` command.
* @param projectRootPath the root path of the project.
* @returns The parsed `DiffMap`.
*/
export declare function parseDiffs(input: string, projectRootPath: string): DiffMap;
//# sourceMappingURL=diff-parser.d.ts.map