Skip to content

Commit

Permalink
fix: correctly write code coverage to coverage/
Browse files Browse the repository at this point in the history
  • Loading branch information
WillieRuemmele committed Apr 10, 2024
1 parent acbb99a commit c8d3059
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
4 changes: 1 addition & 3 deletions src/utils/coverage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 } : {}),
},
];
})
Expand Down
7 changes: 3 additions & 4 deletions test/utils/output.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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' },
},
});
});
Expand Down Expand Up @@ -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' },
},
});
});
Expand Down

0 comments on commit c8d3059

Please sign in to comment.