Exclude files for CodeCoveragePlugin
12 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi community,
I use the CodeCoveragePlugin to generate a coverage report for m-scripts. This is working well (more, less)
Now I try to exclude some files like interfaces and other abstract classes.
Does somebody know how I can do this?
At the moment my configutration looks like:
runner.addPlugin(CodeCoveragePlugin.forFolder([pwd, '\\src\\main'], ...
'IncludingSubfolders', true, 'Producing', codeCovFormat));
But I don't want to separate my interfaces into a folder and list each single folder.
BR
0 comentarios
Respuestas (1)
Will
el 20 de Ag. de 2020
I came here hoping to find an answer to this question, but unfortunately there isn't one yet.
The only solution I can come up with right now is to instead use CodeCoveragePlugin.forFile to explicitly list the files that we do want included in the coverage report.
I would use dir to list all m-files in all subfolders of the folder and then take from that the files to exclude...
% get all m-code files under the folder
dirOut = dir(fullfile(folderPath, '**', '*.m'));
codeFilePaths = string({dirOut.folder}) + filesep + string({dirOut.name});
% remove files to exclude
codeFilePaths(ismember(codeFilePaths, filePathsToExclude)) = [];
% add the code coverage plugin
runner.addPlugin(CodeCoveragePlugin.forFile(codeFilePaths), ...
"Producing", codeCoverageFormat)
I'm using MATLAB R2019b, but I can confirm the above will also work in R2017b.
According to the documentation matlab.unittest.plugins.CodeCoveragePlugin.forFile was introduced in R2017b, so this won't work for older releases.
0 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!