Skip to content

Commit

Permalink
Add end of file marker (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
drazisil-codecov authored Jan 21, 2021
1 parent ca067e6 commit 7b2c1e6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/helpers/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ function endNetworkMarker() {
return "<<<<<< network\n";
}

function endFileMarker() {
return "<<<<<< EOF\n";
}

function fileHeader(filePath) {
return `# path=${filePath}\n`;
}
Expand All @@ -177,6 +181,7 @@ function getFilePath(projectRoot, filePath) {
module.exports = {
readCoverageFile,
getFileListing,
endFileMarker,
endNetworkMarker,
fileHeader,
fetchGitRoot,
Expand Down
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ async function main(args) {
);
uploadFile = uploadFile.concat(fileHelpers.fileHeader(coverageFile));
uploadFile = uploadFile.concat(fileContents);
uploadFile = uploadFile.concat(fileHelpers.endFileMarker());
}

const gzippedFile = zlib.gzipSync(uploadFile);
Expand Down
4 changes: 4 additions & 0 deletions test/helpers/files.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ describe("File Helpers", () => {
expect(fileHelpers.endNetworkMarker()).toBe("<<<<<< network\n");
});

it("can generate file end marker", () => {
expect(fileHelpers.endFileMarker()).toBe("<<<<<< EOF\n");
});

it("can fetch the git root", function() {
const cwd = td.replace(process, 'cwd')
const spawnSync = td.replace(child_process, 'spawnSync')
Expand Down

0 comments on commit 7b2c1e6

Please sign in to comment.