From c8d3059d86ef9a012d636c5500b4f4b0fdb324d2 Mon Sep 17 00:00:00 2001 From: Willie Ruemmele Date: Wed, 10 Apr 2024 16:24:43 -0600 Subject: [PATCH] fix: correctly write code coverage to coverage/ --- src/utils/coverage.ts | 4 +--- test/utils/output.test.ts | 7 +++---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/utils/coverage.ts b/src/utils/coverage.ts index bdbb30bd..fccb30bc 100644 --- a/src/utils/coverage.ts +++ b/src/utils/coverage.ts @@ -56,9 +56,7 @@ export const getCoverageFormattersOptions = (formatters: string[] = []): Coverag // always join any subdir from the defaults with our custom coverage dir ...('subdir' in formatDefaults ? { subdir: path.join('coverage', formatDefaults.subdir) } : {}), // if there is no subdir, we also put the file in the coverage dir, otherwise leave it alone - ...('file' in formatDefaults && !('subdir' in formatDefaults) - ? { file: path.join('coverage', formatDefaults.file) } - : {}), + ...('file' in formatDefaults && !('subdir' in formatDefaults) ? { file: formatDefaults.file } : {}), }, ]; }) diff --git a/test/utils/output.test.ts b/test/utils/output.test.ts index 05796638..cb88cd82 100644 --- a/test/utils/output.test.ts +++ b/test/utils/output.test.ts @@ -4,7 +4,6 @@ * Licensed under the BSD 3-Clause license. * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -import * as path from 'node:path'; import { assert, expect, config } from 'chai'; import sinon from 'sinon'; import { DeployMessage, DeployResult, FileResponse } from '@salesforce/source-deploy-retrieve'; @@ -116,8 +115,8 @@ describe('deployResultFormatter', () => { expect(result).to.deep.equal({ reportFormats: ['clover', 'json'], reportOptions: { - clover: { file: path.join('coverage', 'clover.xml'), projectRoot: '.' }, - json: { file: path.join('coverage', 'coverage.json') }, + clover: { file: 'clover.xml', projectRoot: '.' }, + json: { file: 'coverage.json' }, }, }); }); @@ -157,7 +156,7 @@ describe('deployResultFormatter', () => { expect(result).to.deep.equal({ reportFormats: ['teamcity'], reportOptions: { - teamcity: { file: path.join('coverage', 'teamcity.txt'), blockName: 'coverage' }, + teamcity: { file: 'teamcity.txt', blockName: 'coverage' }, }, }); });