Skip to content

Commit

Permalink
filter suite duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
matepek committed Jan 3, 2019
1 parent d9ad416 commit efdfe3b
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- a bug which caused that `files.exlude` were also applied to pattern. Not anymore.
- a bug which caused to show not file names but patterns in the explorer.
- a bug which allowed suite duplications if more patterns were matching.

## [2.3.8] - 2019-01-03

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"icon": "resources/icon.png",
"author": "Mate Pek",
"publisher": "matepek",
"version": "2.3.8",
"version": "2.3.9",
"license": "Unlicense",
"homepage": "https://github.com/matepek/vscode-catch2-test-adapter",
"repository": {
Expand Down
5 changes: 5 additions & 0 deletions src/RootTestSuiteInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ export class RootTestSuiteInfo implements TestSuiteInfo, vscode.Disposable {
insertChild(suite: TestSuiteInfoBase): boolean {
if (this.children.indexOf(suite) != -1) return false;

// we want to filter the situation when 2 patterns match the same file
if (this.children.find((s: TestSuiteInfoBase) => { return suite.execPath == s.execPath; })) {
return false;
}

let i = this.children.findIndex((v: TestSuiteInfoBase) => {
return suite.label.trim().localeCompare(v.label.trim()) < 0;
});
Expand Down
5 changes: 3 additions & 2 deletions src/TestExecutableInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,9 @@ export class TestExecutableInfo implements vscode.Disposable {
const file = fileUris[i];
await this._createSuiteByUri(file).then((suite: TestSuiteInfoBase) => {
return suite.reloadChildren().then(() => {
this._executables.set(file.fsPath, suite);
this._allTests.insertChild(suite);
if (this._allTests.insertChild(suite)) {
this._executables.set(file.fsPath, suite);
}
}, (reason: any) => {
this._allTests.log.error('Couldn\'t load executable: ' + inspect([reason, suite]));
});
Expand Down

0 comments on commit efdfe3b

Please sign in to comment.