From df4dc107a6f13d10bf2017fe5b3f1ff84b5bb998 Mon Sep 17 00:00:00 2001 From: Kevin Valk Date: Thu, 8 Sep 2022 21:07:04 +0200 Subject: [PATCH] fix: now uses path.join to join the prefix to the filename --- dist/index.js | 6 +++++- src/cobertura.js | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index e04d7705..1baa6cc7 100644 --- a/dist/index.js +++ b/dist/index.js @@ -18497,6 +18497,7 @@ const fs = __nccwpck_require__(5747).promises; const xml2js = __nccwpck_require__(6189); const util = __nccwpck_require__(1669); const glob = __nccwpck_require__(8252); +const pathLib = __nccwpck_require__(5622); const parseString = util.promisify(xml2js.parseString); /** @@ -18519,7 +18520,10 @@ async function readCoverageFromFile(path, options) { .map((klass) => { return { ...calculateRates(klass), - filename: (options.prefixPath || "") + klass["filename"], + filename: + options.prefixPath != null + ? pathLib.join(options.prefixPath, klass["filename"]) + : klass["filename"], name: klass["name"], missing: missingLines(klass), }; diff --git a/src/cobertura.js b/src/cobertura.js index 74669fc5..0537fde9 100644 --- a/src/cobertura.js +++ b/src/cobertura.js @@ -2,6 +2,7 @@ const fs = require("fs").promises; const xml2js = require("xml2js"); const util = require("util"); const glob = require("glob-promise"); +const pathLib = require("path"); const parseString = util.promisify(xml2js.parseString); /** @@ -24,7 +25,10 @@ async function readCoverageFromFile(path, options) { .map((klass) => { return { ...calculateRates(klass), - filename: (options.prefixPath || "") + klass["filename"], + filename: + options.prefixPath != null + ? pathLib.join(options.prefixPath, klass["filename"]) + : klass["filename"], name: klass["name"], missing: missingLines(klass), };