Skip to content

Commit

Permalink
testing: another fix to avoid automatically queuing
Browse files Browse the repository at this point in the history
Fixes #180041 again
  • Loading branch information
connor4312 committed Apr 28, 2023
1 parent a68448f commit 13bdce0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 20 deletions.
4 changes: 0 additions & 4 deletions src/vs/workbench/contrib/testing/common/testResult.ts
Original file line number Diff line number Diff line change
Expand Up @@ -367,10 +367,6 @@ export class LiveTestResult implements ITestResult {
parent = this.addTestToRun(controllerId, chain[i], parent.item.extId);
}

for (let i = 0; i < this.tasks.length; i++) {
this.fireUpdateAndRefresh(parent, i, TestResultState.Queued);
}

return undefined;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ import { TestStorageService } from 'vs/workbench/test/common/workbenchTestServic
suite('Workbench - Test Results Service', () => {
const getLabelsIn = (it: Iterable<TestResultItem>) => [...it].map(t => t.item.label).sort();
const getChangeSummary = () => [...changed]
.map(c => ({ reason: c.reason, label: c.item.item.label }))
.sort((a, b) => a.label.localeCompare(b.label));
.map(c => ({ reason: c.reason, label: c.item.item.label }));

let r: TestLiveTestResult;
let changed = new Set<TestResultItemChange>();
Expand Down Expand Up @@ -85,13 +84,8 @@ suite('Workbench - Test Results Service', () => {
).tests), []);
});

test('initially queues with update', () => {
assert.deepStrictEqual(getChangeSummary(), [
{ label: 'a', reason: TestResultItemChangeReason.ComputedStateChange },
{ label: 'aa', reason: TestResultItemChangeReason.OwnStateChange },
{ label: 'ab', reason: TestResultItemChangeReason.OwnStateChange },
{ label: 'root', reason: TestResultItemChangeReason.ComputedStateChange },
]);
test('initially queues nothing', () => {
assert.deepStrictEqual(getChangeSummary(), []);
});

test('initializes with the subtree of requested tests', () => {
Expand All @@ -101,8 +95,7 @@ suite('Workbench - Test Results Service', () => {
test('initializes with valid counts', () => {
assert.deepStrictEqual(r.counts, {
...makeEmptyCounts(),
[TestResultState.Queued]: 2,
[TestResultState.Unset]: 2,
[TestResultState.Unset]: 4,
});
});

Expand All @@ -126,9 +119,14 @@ suite('Workbench - Test Results Service', () => {
assert.deepStrictEqual(r.getStateById(new TestId(['ctrlId', 'id-a']).toString())?.tasks[0].state, TestResultState.Failed);
assert.deepStrictEqual(getChangeSummary(), [
{ label: 'a', reason: TestResultItemChangeReason.OwnStateChange },
{ label: 'root', reason: TestResultItemChangeReason.ComputedStateChange },
{ label: 'aa', reason: TestResultItemChangeReason.OwnStateChange },
{ label: 'ab', reason: TestResultItemChangeReason.OwnStateChange },

{ label: 'a', reason: TestResultItemChangeReason.OwnStateChange },
{ label: 'root', reason: TestResultItemChangeReason.ComputedStateChange },
{ label: 'aa', reason: TestResultItemChangeReason.OwnStateChange },
{ label: 'ab', reason: TestResultItemChangeReason.OwnStateChange },
]);
});

Expand All @@ -138,16 +136,15 @@ suite('Workbench - Test Results Service', () => {
r.updateState(testId, 't', TestResultState.Running);
assert.deepStrictEqual(r.counts, {
...makeEmptyCounts(),
[TestResultState.Unset]: 2,
[TestResultState.Unset]: 3,
[TestResultState.Running]: 1,
[TestResultState.Queued]: 1,
});
assert.deepStrictEqual(r.getStateById(testId)?.ownComputedState, TestResultState.Running);
// update computed state:
assert.deepStrictEqual(r.getStateById(tests.root.id)?.computedState, TestResultState.Running);
assert.deepStrictEqual(getChangeSummary(), [
{ label: 'a', reason: TestResultItemChangeReason.ComputedStateChange },
{ label: 'aa', reason: TestResultItemChangeReason.OwnStateChange },
{ label: 'a', reason: TestResultItemChangeReason.ComputedStateChange },
{ label: 'root', reason: TestResultItemChangeReason.ComputedStateChange },
]);

Expand All @@ -166,8 +163,7 @@ suite('Workbench - Test Results Service', () => {
r.updateState(new TestId(['ctrlId', 'id-b']).toString(), 't', TestResultState.Running);
assert.deepStrictEqual(r.counts, {
...makeEmptyCounts(),
[TestResultState.Queued]: 2,
[TestResultState.Unset]: 2,
[TestResultState.Unset]: 4,
});
assert.deepStrictEqual(r.getStateById(new TestId(['ctrlId', 'id-b']).toString()), undefined);
});
Expand Down

0 comments on commit 13bdce0

Please sign in to comment.