Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Create a custom Logger to gather the data from the test run #271

Draft
wants to merge 38 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
3e5bcda
Started implementing a DataCollector
GeorchW Jun 9, 2020
2aa35dc
Implement basic TCP server in the extension
GeorchW Jun 9, 2020
e8cfd4e
Tidying up executor, part 1
GeorchW Jun 9, 2020
429f945
Tidying up executor, part 2
GeorchW Jun 9, 2020
b58f8bd
Add code to set the server port for the subprocess
GeorchW Jun 9, 2020
5f277ad
Add publish dir to .gitignore
GeorchW Jun 9, 2020
edddb24
Add process env back in
GeorchW Jun 9, 2020
ce6b03f
Add data collector arguments to dotnet test
GeorchW Jun 9, 2020
b84e3a1
Send some slightly less nonsense data
GeorchW Jun 9, 2020
8b2fc4f
Send data as JSON
GeorchW Jun 9, 2020
4511b76
Make Executor.exec awaitable
GeorchW Jun 9, 2020
0d665bb
Make use of the received data
GeorchW Jun 9, 2020
a0db0fd
Use Logger instead of DataCollector API
GeorchW Jun 10, 2020
b4db6e3
Minor corrections
GeorchW Jun 10, 2020
560222f
Tidy up a little
GeorchW Jun 10, 2020
37353bc
Don't parse trx
GeorchW Jun 10, 2020
79527ef
Rename ITestResult => ITestResults
GeorchW Jun 10, 2020
3abb168
Fix event surface
GeorchW Jun 10, 2020
2bee683
Remove testResultsFile
GeorchW Jun 10, 2020
7062995
Clean up TestResult class
GeorchW Jun 10, 2020
3e7a541
Make an interface out of TestResult
GeorchW Jun 10, 2020
3a77b44
Use logger for test discovery
GeorchW Jun 10, 2020
d3e96f8
Remove unused usings
GeorchW Jun 11, 2020
50bfeee
Notify watcher of start/end of test run
GeorchW Jun 11, 2020
358bc47
Rework tree code
GeorchW Jun 11, 2020
8df96c9
Clean up subprocess logging
GeorchW Jun 11, 2020
acacf60
Spam less output
GeorchW Jun 11, 2020
c83800b
Apply old test results after discovery
GeorchW Jun 11, 2020
974ae83
Fix watch, remove tests that are not found
GeorchW Jun 11, 2020
8e96ffd
Fix gotoTest
GeorchW Jun 11, 2020
3d3df54
Log child process output by default
GeorchW Jun 11, 2020
044955c
Fix weird XUnit names
GeorchW Jun 11, 2020
d410eeb
Replace then with async/await
GeorchW Jun 11, 2020
5403938
Send messages asynchronously
GeorchW Jun 12, 2020
579e9d0
Rebuild tree when tests are removed
GeorchW Jun 12, 2020
09f7e83
Add proper names
GeorchW Jun 12, 2020
18effd7
Update language version
GeorchW Feb 26, 2022
f6fef75
Update packages
GeorchW Feb 26, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Apply old test results after discovery
  • Loading branch information
GeorchW committed Jun 11, 2020
commit c83800b7201a315481e1af46625c0a4615f951e8
10 changes: 7 additions & 3 deletions src/dotnetTestExplorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ export class DotnetTestExplorer implements TreeDataProvider<TreeNode> {
collapsibleState: Utility.defaultCollapsibleState,
iconPath: this.getIcon(
element.state === "Running" ? "spinner.svg" :
element.state === "NotRun" ? "namespace.png" :
`namespace${element.state}.png`),
element.state === "NotRun" ? "namespace.png" :
`namespace${element.state}.png`),
contextValue: "folder"
}
} else if (element instanceof LoadingTreeNode) {
Expand Down Expand Up @@ -132,16 +132,20 @@ export class DotnetTestExplorer implements TreeDataProvider<TreeNode> {

private createConcreteTree(parentNamespace: string, abstractTree: ITestTreeNode): FolderNode {
const result = new FolderNode(abstractTree.fullName, abstractTree.name);
this.registerNode(result);
for (const subNamespace of abstractTree.subTrees.values()) {
result.addFolderNode(this.createConcreteTree(abstractTree.fullName, subNamespace));
}
for (const test of abstractTree.tests) {
const fullName = `${abstractTree.fullName}.${test}`;
const testNode = new TestNode(fullName, test);
const outcome = this.testResults.get(fullName)?.outcome;
if (outcome && outcome !== "None" && outcome !== "NotFound") {
testNode.state = outcome;
}
this.registerNode(testNode);
result.addTestNode(testNode);
}
this.registerNode(result);
return result;
}

Expand Down
16 changes: 10 additions & 6 deletions src/treeNodes/folderNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@ import { TestNode } from "./testNode";
export class FolderNode extends TreeNode {
private _subFolders: FolderNode[] = [];
private _tests: TestNode[] = [];
private _state: TreeTestState = "NotRun";
private _state: TreeTestState;
public readonly fullName: string;
public get state() { return this._state; }
private setState(newState: TreeTestState) {
if (newState !== this._state) {
this._state = newState;
this._nodeChanged.fire();
}
}
private *_children() {
for (const folder of this._subFolders) {
yield folder;
Expand All @@ -24,18 +30,16 @@ export class FolderNode extends TreeNode {
this._tests.push(node);
this._nodeChanged.fire();
node.nodeChanged(() => this.updateState());
this.setState(mergeStates(this.state, node.state));
}
public addFolderNode(node: FolderNode) {
this._subFolders.push(node);
this._nodeChanged.fire();
node.nodeChanged(() => this.updateState());
this.setState(mergeStates(this.state, node.state));
}
private updateState() {
const newState = this.getNewState();
if (newState !== this._state) {
this._state = newState;
this._nodeChanged.fire();
}
this.setState(this.getNewState());
}
private getNewState(): TreeTestState {
let newState;
Expand Down