diff --git a/src/files/filesloader.ts b/src/files/filesloader.ts index c6d1f3a..9696107 100644 --- a/src/files/filesloader.ts +++ b/src/files/filesloader.ts @@ -22,7 +22,7 @@ export class FilesLoader { const fileNames = this.configStore.coverageFileNames; const files = await this.findCoverageInWorkspace(fileNames); if (!files.size) { - window.showWarningMessage("Could not find a Coverage file!"); + window.showWarningMessage("Could not find a Coverage file! Searched for " + fileNames.join(", ")); return new Set(); } return files; @@ -92,9 +92,16 @@ export class FilesLoader { dot: true, ignore: this.configStore.ignoredPathGlobs, realpath: true, + strict: false, }, (err, files) => { - if (!files || !files.length) { return resolve(new Set()); } + if (!files || !files.length) { + // Show any errors if no file was found. + if (err) { + window.showWarningMessage(`An error occured while looking for the coverage file ${err}`); + } + return resolve(new Set()); + } const setFiles = new Set(); files.forEach((file) => setFiles.add(file)); return resolve(setFiles); diff --git a/test/files/filesloader.test.ts b/test/files/filesloader.test.ts index cfa6897..8c599e0 100644 --- a/test/files/filesloader.test.ts +++ b/test/files/filesloader.test.ts @@ -27,13 +27,14 @@ suite("FilesLoader Tests", () => { test("findCoverageFiles returns an error if no coverage file @unit", async () => { stubConfig.manualCoverageFilePaths = []; + stubConfig.coverageFileNames = ["lcov.info"]; const filesLoader = new FilesLoader(stubConfig); sinon.stub(filesLoader as any, "findCoverageInWorkspace").resolves(new Map()); const stubShowWarningMessage = sinon.spy(vscode.window, "showWarningMessage"); await filesLoader.findCoverageFiles(); - expect(stubShowWarningMessage).to.be.calledWith("Could not find a Coverage file!"); + expect(stubShowWarningMessage).to.be.calledWith("Could not find a Coverage file! Searched for lcov.info"); }); test("findCoverageFiles returns manual coverage paths if set @unit", async () => {