Skip to content

Commit

Permalink
[#104] Add failing test for multi root workspace
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanluker committed Jan 28, 2018
1 parent 22d75cf commit 386cc73
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/indicators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class Indicators {

// on Windows remove drive letter from path because of cobertura format
// also convert both path to lowercase because Windows's filesystem is case insensitive
if ( process.platform === "win32" ) {
if (process.platform === "win32") {
cleanFile = cleanFile.substr(2).toLowerCase();
cleanLcovFileSection = cleanLcovFileSection.toLowerCase();
}
Expand Down
30 changes: 30 additions & 0 deletions test/indicators.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,11 +306,41 @@ suite("Indicators Tests", function() {
});
});

test.only("#extract: should find a matching file when in multi" +
" folder workspace mode", function(done) {
fakeConfig.altSfCompare = true;
const vscodeImpl = new Vscode();
vscodeImpl.getWorkspaceFolders = function() { return [
{uri: {path: "python/user/code"}, name: "python"} as any,
{uri: {path: "vscode-coverage-gutters/user/code"}, name: "vscode-coverage-gutters"} as any,
]; };
const parseImpl = new LcovParse();
// tslint:disable-next-line:max-line-length
const fakeLinuxLcov = "TN:\nSF:/mnt/c/dev/vscode-coverage-gutters/example/test-coverage.js\nDA:1,1\nend_of_record";
const fakeFile = "/mnt/c/dev/vscode-coverage-gutters/example/test-coverage.js";
const xmlImpl = new XmlParse();
const indicators = new Indicators(
xmlImpl,
parseImpl,
vscodeImpl,
fakeConfig,
);
indicators.extractCoverage(fakeLinuxLcov, fakeFile)
.then(function(data) {
assert.equal(data.lines.details.length, 1);
return done();
})
.catch(function(error) {
return done(error);
});
});

test("#extract: should find a matching file with relative match mode", function(done) {
fakeConfig.altSfCompare = true;
const vscodeImpl = new Vscode();
vscodeImpl.getWorkspaceFolders = function() { return [
{uri: {path: "vscode-coverage-gutters"}, name: "vscode-coverage-gutters"} as any,
{uri: {path: "vscode-coverage-gutters/user/code"}, name: "python"} as any,
]; };
const parseImpl = new LcovParse();
// tslint:disable-next-line:max-line-length
Expand Down

0 comments on commit 386cc73

Please sign in to comment.