mirror of
https://github.com/Microsoft/vscode
synced 2024-09-13 13:46:13 +00:00
parent
8b4a90726d
commit
b080fa237c
|
@ -65,6 +65,17 @@ export interface IMainThreadTestCollection extends AbstractIncrementalTestCollec
|
|||
getReviverDiff(): TestsDiff;
|
||||
}
|
||||
|
||||
/**
|
||||
* Iterates through the item and its parents to the root.
|
||||
*/
|
||||
export const getCollectionItemParents = function* (collection: IMainThreadTestCollection, item: InternalTestItem) {
|
||||
let p: InternalTestItem | undefined = item;
|
||||
while (p) {
|
||||
yield p;
|
||||
p = p.parent ? collection.getNodeById(p.parent) : undefined;
|
||||
}
|
||||
};
|
||||
|
||||
export const waitForAllRoots = (collection: IMainThreadTestCollection, ct = CancellationToken.None) => {
|
||||
if (collection.pendingRootProviders === 0 || ct.isCancellationRequested) {
|
||||
return Promise.resolve();
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
import { RunOnceScheduler } from 'vs/base/common/async';
|
||||
import { CancellationTokenSource } from 'vs/base/common/cancellation';
|
||||
import { Iterable } from 'vs/base/common/iterator';
|
||||
import { Disposable, DisposableStore, MutableDisposable, toDisposable } from 'vs/base/common/lifecycle';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
|
@ -12,10 +13,9 @@ import { createDecorator } from 'vs/platform/instantiation/common/instantiation'
|
|||
import { AutoRunMode, getTestingConfiguration, TestingConfigKeys } from 'vs/workbench/contrib/testing/common/configuration';
|
||||
import { TestDiffOpType, TestIdWithMaybeSrc } from 'vs/workbench/contrib/testing/common/testCollection';
|
||||
import { TestingContextKeys } from 'vs/workbench/contrib/testing/common/testingContextKeys';
|
||||
import { isStateWithResult } from 'vs/workbench/contrib/testing/common/testingStates';
|
||||
import { TestResultItemChangeReason } from 'vs/workbench/contrib/testing/common/testResult';
|
||||
import { isRunningTests, ITestResultService } from 'vs/workbench/contrib/testing/common/testResultService';
|
||||
import { ITestService } from 'vs/workbench/contrib/testing/common/testService';
|
||||
import { getCollectionItemParents, ITestService } from 'vs/workbench/contrib/testing/common/testService';
|
||||
import { IWorkspaceTestCollectionService } from 'vs/workbench/contrib/testing/common/workspaceTestCollectionService';
|
||||
|
||||
export interface ITestingAutoRun {
|
||||
|
@ -116,7 +116,7 @@ export class TestingAutoRun extends Disposable implements ITestingAutoRun {
|
|||
store.add(this.results.onTestChanged(evt => {
|
||||
if (evt.reason === TestResultItemChangeReason.Retired) {
|
||||
addToRerun({ testId: evt.item.item.extId });
|
||||
} else if ((evt.reason === TestResultItemChangeReason.OwnStateChange || evt.reason === TestResultItemChangeReason.ComputedStateChange) && isStateWithResult(evt.item.computedState)) {
|
||||
} else if ((evt.reason === TestResultItemChangeReason.OwnStateChange || evt.reason === TestResultItemChangeReason.ComputedStateChange)) {
|
||||
removeFromRerun({ testId: evt.item.item.extId });
|
||||
}
|
||||
}));
|
||||
|
@ -142,11 +142,18 @@ export class TestingAutoRun extends Disposable implements ITestingAutoRun {
|
|||
}
|
||||
});
|
||||
|
||||
store.add(listener.onDiff(({ diff }) => {
|
||||
store.add(listener.onDiff(({ diff, folder }) => {
|
||||
for (const entry of diff) {
|
||||
if (entry[0] === TestDiffOpType.Add) {
|
||||
const { item, src } = entry[1];
|
||||
addToRerun({ testId: item.extId, src });
|
||||
const test = entry[1];
|
||||
const isQueued = Iterable.some(
|
||||
getCollectionItemParents(folder.collection, test),
|
||||
t => rerunIds.has(identifyTest({ testId: t.item.extId, src: t.src })),
|
||||
);
|
||||
|
||||
if (!isQueued) {
|
||||
addToRerun({ testId: test.item.extId, src: test.src });
|
||||
}
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
|
Loading…
Reference in a new issue