diff --git a/package-lock.json b/package-lock.json index 924974c..606ab78 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "testcafe-reporter-testrail", - "version": "0.6.1", + "version": "0.6.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 6da425e..c0b6966 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "testcafe-reporter-testrail", - "version": "0.6.1", + "version": "0.6.2", "description": "Testcafe reporter plugin that automatically publishes test run details to the TestRail system.", "main": "lib/index.js", "files": [ diff --git a/src/index.ts b/src/index.ts index bbed9b8..311a49e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -71,11 +71,14 @@ const Status = { }; const loadJSON = (file: string) => { - const data = fs.readFileSync(file, { encoding: "utf8" }); + try { + const data = fs.readFileSync(file, { encoding: "utf8" }); + + if (data) { + return JSON.parse(data); + } + } catch {} - if (data) { - return JSON.parse(data); - } return {}; };