@theia/test 1.53.0-next.55 → 1.53.0-next.64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +7 -7
- package/src/browser/constants.ts +71 -71
- package/src/browser/style/index.css +41 -41
- package/src/browser/test-execution-progress-service.ts +53 -53
- package/src/browser/test-preferences.ts +58 -58
- package/src/browser/test-service.ts +402 -402
- package/src/browser/view/test-context-key-service.ts +36 -36
- package/src/browser/view/test-execution-state-manager.ts +147 -147
- package/src/browser/view/test-output-ui-model.ts +156 -156
- package/src/browser/view/test-output-view-contribution.ts +34 -34
- package/src/browser/view/test-output-widget.ts +148 -148
- package/src/browser/view/test-result-view-contribution.ts +34 -34
- package/src/browser/view/test-result-widget.ts +92 -92
- package/src/browser/view/test-run-view-contribution.ts +89 -89
- package/src/browser/view/test-run-widget.tsx +271 -271
- package/src/browser/view/test-tree-widget.tsx +360 -360
- package/src/browser/view/test-view-contribution.ts +328 -328
- package/src/browser/view/test-view-frontend-module.ts +136 -136
- package/src/common/collections.ts +223 -223
- package/src/common/tree-delta.spec.ts +166 -166
- package/src/common/tree-delta.ts +259 -259
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2023 STMicroelectronics and others.
|
|
3
|
-
//
|
|
4
|
-
// This program and the accompanying materials are made available under the
|
|
5
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
//
|
|
8
|
-
// This Source Code may also be made available under the following Secondary
|
|
9
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
-
// with the GNU Classpath Exception which is available at
|
|
12
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
-
//
|
|
14
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
-
// *****************************************************************************
|
|
16
|
-
|
|
17
|
-
import { injectable, inject, postConstruct } from '@theia/core/shared/inversify';
|
|
18
|
-
import { ContextKeyService, ContextKey } from '@theia/core/lib/browser/context-key-service';
|
|
19
|
-
|
|
20
|
-
@injectable()
|
|
21
|
-
export class TestContextKeyService {
|
|
22
|
-
|
|
23
|
-
@inject(ContextKeyService)
|
|
24
|
-
protected readonly contextKeyService: ContextKeyService;
|
|
25
|
-
|
|
26
|
-
protected _contextValue: ContextKey<string | undefined>;
|
|
27
|
-
get contextValue(): ContextKey<string | undefined> {
|
|
28
|
-
return this._contextValue;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
@postConstruct()
|
|
32
|
-
protected init(): void {
|
|
33
|
-
this._contextValue = this.contextKeyService.createKey<string | undefined>('testMessage', undefined);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
}
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2023 STMicroelectronics and others.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
import { injectable, inject, postConstruct } from '@theia/core/shared/inversify';
|
|
18
|
+
import { ContextKeyService, ContextKey } from '@theia/core/lib/browser/context-key-service';
|
|
19
|
+
|
|
20
|
+
@injectable()
|
|
21
|
+
export class TestContextKeyService {
|
|
22
|
+
|
|
23
|
+
@inject(ContextKeyService)
|
|
24
|
+
protected readonly contextKeyService: ContextKeyService;
|
|
25
|
+
|
|
26
|
+
protected _contextValue: ContextKey<string | undefined>;
|
|
27
|
+
get contextValue(): ContextKey<string | undefined> {
|
|
28
|
+
return this._contextValue;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@postConstruct()
|
|
32
|
+
protected init(): void {
|
|
33
|
+
this._contextValue = this.contextKeyService.createKey<string | undefined>('testMessage', undefined);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
}
|
|
@@ -1,147 +1,147 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2023 STMicroelectronics and others.
|
|
3
|
-
//
|
|
4
|
-
// This program and the accompanying materials are made available under the
|
|
5
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
//
|
|
8
|
-
// This Source Code may also be made available under the following Secondary
|
|
9
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
-
// with the GNU Classpath Exception which is available at
|
|
12
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
-
//
|
|
14
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
-
// *****************************************************************************
|
|
16
|
-
|
|
17
|
-
import { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
|
|
18
|
-
import { TestController, TestExecutionState, TestItem, TestRun, TestService } from '../test-service';
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* This class manages the state of "internal" nodes in the test tree
|
|
22
|
-
*/
|
|
23
|
-
@injectable()
|
|
24
|
-
export class TestExecutionStateManager {
|
|
25
|
-
@inject(TestService)
|
|
26
|
-
protected readonly testService: TestService;
|
|
27
|
-
|
|
28
|
-
private executionStates = new Map<TestRun, TestExecutionStateMap>();
|
|
29
|
-
|
|
30
|
-
@postConstruct()
|
|
31
|
-
init(): void {
|
|
32
|
-
this.testService.getControllers().forEach(controller => this.addController(controller));
|
|
33
|
-
this.testService.onControllersChanged(controllerDelta => {
|
|
34
|
-
controllerDelta.added?.forEach(controller => this.addController(controller));
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
addController(controller: TestController): void {
|
|
38
|
-
controller.testRuns.forEach(run => this.addRun(run));
|
|
39
|
-
controller.onRunsChanged(runDelta => {
|
|
40
|
-
runDelta.added?.forEach(run => this.addRun(run));
|
|
41
|
-
runDelta.removed?.forEach(run => {
|
|
42
|
-
this.executionStates.delete(run);
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
addRun(run: TestRun): void {
|
|
47
|
-
this.executionStates.set(run, new TestExecutionStateMap);
|
|
48
|
-
run.onDidChangeTestState(updates => {
|
|
49
|
-
updates.forEach(update => {
|
|
50
|
-
this.updateState(run, update.test, update.oldState?.state, update.newState?.state);
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
protected updateState(run: TestRun, item: TestItem, oldState: TestExecutionState | undefined, newState: TestExecutionState | undefined): void {
|
|
56
|
-
const map = this.executionStates.get(run)!;
|
|
57
|
-
map.reportState(item, oldState, newState);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
getComputedState(run: TestRun, item: TestItem): TestExecutionState | undefined {
|
|
61
|
-
return this.executionStates.get(run)?.getComputedState(item);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
class TestExecutionStateMap {
|
|
66
|
-
reportState(item: TestItem, oldState: TestExecutionState | undefined, newState: TestExecutionState | undefined): void {
|
|
67
|
-
if (oldState !== newState) {
|
|
68
|
-
if (item.parent) {
|
|
69
|
-
this.reportChildStateChanged(item.parent, oldState, newState);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
reportChildStateChanged(parent: TestItem, oldState: TestExecutionState | undefined, newState: TestExecutionState | undefined): void {
|
|
74
|
-
if (oldState !== newState) {
|
|
75
|
-
const currentParentState = this.getComputedState(parent);
|
|
76
|
-
let counts = this.stateCounts.get(parent);
|
|
77
|
-
if (!counts) {
|
|
78
|
-
counts = [];
|
|
79
|
-
counts[TestExecutionState.Queued] = 0;
|
|
80
|
-
counts[TestExecutionState.Running] = 0;
|
|
81
|
-
counts[TestExecutionState.Passed] = 0;
|
|
82
|
-
counts[TestExecutionState.Failed] = 0;
|
|
83
|
-
counts[TestExecutionState.Skipped] = 0;
|
|
84
|
-
counts[TestExecutionState.Errored] = 0;
|
|
85
|
-
this.stateCounts.set(parent, counts);
|
|
86
|
-
}
|
|
87
|
-
if (oldState) {
|
|
88
|
-
counts[oldState]--;
|
|
89
|
-
}
|
|
90
|
-
if (newState) {
|
|
91
|
-
counts[newState]++;
|
|
92
|
-
}
|
|
93
|
-
const newParentState = this.getComputedState(parent);
|
|
94
|
-
if (parent.parent && currentParentState !== newParentState) {
|
|
95
|
-
this.reportChildStateChanged(parent.parent, currentParentState, newParentState!);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
private stateCounts: Map<TestItem | TestController, number[]> = new Map();
|
|
101
|
-
|
|
102
|
-
updateState(item: TestItem, oldState: TestExecutionState | undefined, newState: TestExecutionState): void {
|
|
103
|
-
let parent = item.parent;
|
|
104
|
-
while (parent && 'parent' in parent) { // parent is a test item
|
|
105
|
-
let counts = this.stateCounts.get(parent);
|
|
106
|
-
if (!counts) {
|
|
107
|
-
counts = [];
|
|
108
|
-
counts[TestExecutionState.Queued] = 0;
|
|
109
|
-
counts[TestExecutionState.Running] = 0;
|
|
110
|
-
counts[TestExecutionState.Passed] = 0;
|
|
111
|
-
counts[TestExecutionState.Failed] = 0;
|
|
112
|
-
counts[TestExecutionState.Skipped] = 0;
|
|
113
|
-
counts[TestExecutionState.Errored] = 0;
|
|
114
|
-
this.stateCounts.set(parent, counts);
|
|
115
|
-
}
|
|
116
|
-
if (oldState) {
|
|
117
|
-
counts[oldState]--;
|
|
118
|
-
}
|
|
119
|
-
counts[newState]++;
|
|
120
|
-
parent = parent.parent;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
getComputedState(item: TestItem): TestExecutionState | undefined {
|
|
125
|
-
const counts = this.stateCounts.get(item);
|
|
126
|
-
if (counts) {
|
|
127
|
-
if (counts[TestExecutionState.Errored] > 0) {
|
|
128
|
-
return TestExecutionState.Errored;
|
|
129
|
-
} else if (counts[TestExecutionState.Failed] > 0) {
|
|
130
|
-
return TestExecutionState.Failed;
|
|
131
|
-
} else if (counts[TestExecutionState.Running] > 0) {
|
|
132
|
-
return TestExecutionState.Running;
|
|
133
|
-
} else if (counts[TestExecutionState.Queued] > 0) {
|
|
134
|
-
return TestExecutionState.Queued;
|
|
135
|
-
} else if (counts[TestExecutionState.Passed] > 0) {
|
|
136
|
-
return TestExecutionState.Passed;
|
|
137
|
-
} else if (counts[TestExecutionState.Skipped] > 0) {
|
|
138
|
-
return TestExecutionState.Skipped;
|
|
139
|
-
} else {
|
|
140
|
-
return undefined;
|
|
141
|
-
}
|
|
142
|
-
} else {
|
|
143
|
-
return undefined;
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2023 STMicroelectronics and others.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
import { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
|
|
18
|
+
import { TestController, TestExecutionState, TestItem, TestRun, TestService } from '../test-service';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* This class manages the state of "internal" nodes in the test tree
|
|
22
|
+
*/
|
|
23
|
+
@injectable()
|
|
24
|
+
export class TestExecutionStateManager {
|
|
25
|
+
@inject(TestService)
|
|
26
|
+
protected readonly testService: TestService;
|
|
27
|
+
|
|
28
|
+
private executionStates = new Map<TestRun, TestExecutionStateMap>();
|
|
29
|
+
|
|
30
|
+
@postConstruct()
|
|
31
|
+
init(): void {
|
|
32
|
+
this.testService.getControllers().forEach(controller => this.addController(controller));
|
|
33
|
+
this.testService.onControllersChanged(controllerDelta => {
|
|
34
|
+
controllerDelta.added?.forEach(controller => this.addController(controller));
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
addController(controller: TestController): void {
|
|
38
|
+
controller.testRuns.forEach(run => this.addRun(run));
|
|
39
|
+
controller.onRunsChanged(runDelta => {
|
|
40
|
+
runDelta.added?.forEach(run => this.addRun(run));
|
|
41
|
+
runDelta.removed?.forEach(run => {
|
|
42
|
+
this.executionStates.delete(run);
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
addRun(run: TestRun): void {
|
|
47
|
+
this.executionStates.set(run, new TestExecutionStateMap);
|
|
48
|
+
run.onDidChangeTestState(updates => {
|
|
49
|
+
updates.forEach(update => {
|
|
50
|
+
this.updateState(run, update.test, update.oldState?.state, update.newState?.state);
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
protected updateState(run: TestRun, item: TestItem, oldState: TestExecutionState | undefined, newState: TestExecutionState | undefined): void {
|
|
56
|
+
const map = this.executionStates.get(run)!;
|
|
57
|
+
map.reportState(item, oldState, newState);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
getComputedState(run: TestRun, item: TestItem): TestExecutionState | undefined {
|
|
61
|
+
return this.executionStates.get(run)?.getComputedState(item);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
class TestExecutionStateMap {
|
|
66
|
+
reportState(item: TestItem, oldState: TestExecutionState | undefined, newState: TestExecutionState | undefined): void {
|
|
67
|
+
if (oldState !== newState) {
|
|
68
|
+
if (item.parent) {
|
|
69
|
+
this.reportChildStateChanged(item.parent, oldState, newState);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
reportChildStateChanged(parent: TestItem, oldState: TestExecutionState | undefined, newState: TestExecutionState | undefined): void {
|
|
74
|
+
if (oldState !== newState) {
|
|
75
|
+
const currentParentState = this.getComputedState(parent);
|
|
76
|
+
let counts = this.stateCounts.get(parent);
|
|
77
|
+
if (!counts) {
|
|
78
|
+
counts = [];
|
|
79
|
+
counts[TestExecutionState.Queued] = 0;
|
|
80
|
+
counts[TestExecutionState.Running] = 0;
|
|
81
|
+
counts[TestExecutionState.Passed] = 0;
|
|
82
|
+
counts[TestExecutionState.Failed] = 0;
|
|
83
|
+
counts[TestExecutionState.Skipped] = 0;
|
|
84
|
+
counts[TestExecutionState.Errored] = 0;
|
|
85
|
+
this.stateCounts.set(parent, counts);
|
|
86
|
+
}
|
|
87
|
+
if (oldState) {
|
|
88
|
+
counts[oldState]--;
|
|
89
|
+
}
|
|
90
|
+
if (newState) {
|
|
91
|
+
counts[newState]++;
|
|
92
|
+
}
|
|
93
|
+
const newParentState = this.getComputedState(parent);
|
|
94
|
+
if (parent.parent && currentParentState !== newParentState) {
|
|
95
|
+
this.reportChildStateChanged(parent.parent, currentParentState, newParentState!);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
private stateCounts: Map<TestItem | TestController, number[]> = new Map();
|
|
101
|
+
|
|
102
|
+
updateState(item: TestItem, oldState: TestExecutionState | undefined, newState: TestExecutionState): void {
|
|
103
|
+
let parent = item.parent;
|
|
104
|
+
while (parent && 'parent' in parent) { // parent is a test item
|
|
105
|
+
let counts = this.stateCounts.get(parent);
|
|
106
|
+
if (!counts) {
|
|
107
|
+
counts = [];
|
|
108
|
+
counts[TestExecutionState.Queued] = 0;
|
|
109
|
+
counts[TestExecutionState.Running] = 0;
|
|
110
|
+
counts[TestExecutionState.Passed] = 0;
|
|
111
|
+
counts[TestExecutionState.Failed] = 0;
|
|
112
|
+
counts[TestExecutionState.Skipped] = 0;
|
|
113
|
+
counts[TestExecutionState.Errored] = 0;
|
|
114
|
+
this.stateCounts.set(parent, counts);
|
|
115
|
+
}
|
|
116
|
+
if (oldState) {
|
|
117
|
+
counts[oldState]--;
|
|
118
|
+
}
|
|
119
|
+
counts[newState]++;
|
|
120
|
+
parent = parent.parent;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
getComputedState(item: TestItem): TestExecutionState | undefined {
|
|
125
|
+
const counts = this.stateCounts.get(item);
|
|
126
|
+
if (counts) {
|
|
127
|
+
if (counts[TestExecutionState.Errored] > 0) {
|
|
128
|
+
return TestExecutionState.Errored;
|
|
129
|
+
} else if (counts[TestExecutionState.Failed] > 0) {
|
|
130
|
+
return TestExecutionState.Failed;
|
|
131
|
+
} else if (counts[TestExecutionState.Running] > 0) {
|
|
132
|
+
return TestExecutionState.Running;
|
|
133
|
+
} else if (counts[TestExecutionState.Queued] > 0) {
|
|
134
|
+
return TestExecutionState.Queued;
|
|
135
|
+
} else if (counts[TestExecutionState.Passed] > 0) {
|
|
136
|
+
return TestExecutionState.Passed;
|
|
137
|
+
} else if (counts[TestExecutionState.Skipped] > 0) {
|
|
138
|
+
return TestExecutionState.Skipped;
|
|
139
|
+
} else {
|
|
140
|
+
return undefined;
|
|
141
|
+
}
|
|
142
|
+
} else {
|
|
143
|
+
return undefined;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|