From 7b2c1e6f19c7a4ec206e9694f420b8d5f47e8077 Mon Sep 17 00:00:00 2001 From: Joe Becher <71270647+drazisil-codecov@users.noreply.github.com> Date: Thu, 21 Jan 2021 13:43:45 -0500 Subject: [PATCH] Add end of file marker (#45) --- src/helpers/files.js | 5 +++++ src/index.js | 1 + test/helpers/files.test.js | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/src/helpers/files.js b/src/helpers/files.js index 2c8efe147..57b36d34b 100644 --- a/src/helpers/files.js +++ b/src/helpers/files.js @@ -156,6 +156,10 @@ function endNetworkMarker() { return "<<<<<< network\n"; } +function endFileMarker() { + return "<<<<<< EOF\n"; +} + function fileHeader(filePath) { return `# path=${filePath}\n`; } @@ -177,6 +181,7 @@ function getFilePath(projectRoot, filePath) { module.exports = { readCoverageFile, getFileListing, + endFileMarker, endNetworkMarker, fileHeader, fetchGitRoot, diff --git a/src/index.js b/src/index.js index 79de88c1c..263f3f240 100644 --- a/src/index.js +++ b/src/index.js @@ -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); diff --git a/test/helpers/files.test.js b/test/helpers/files.test.js index 3a7c606cc..33ff034b5 100644 --- a/test/helpers/files.test.js +++ b/test/helpers/files.test.js @@ -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')