one listTests at a time
This commit is contained in:
parent
b9173b05ef
commit
b97bed5e31
|
|
@ -98,26 +98,26 @@ export async function runWatchModeLoop(configLocation: ConfigLocation, initialOp
|
||||||
let onDirtyTests = new ManualPromise();
|
let onDirtyTests = new ManualPromise();
|
||||||
|
|
||||||
let queue = Promise.resolve();
|
let queue = Promise.resolve();
|
||||||
|
const changedFiles = new Set<string>();
|
||||||
testServerConnection.onTestFilesChanged(({ testFiles: changedFiles }) => {
|
testServerConnection.onTestFilesChanged(({ testFiles }) => {
|
||||||
if (changedFiles.length === 0)
|
testFiles.forEach(file => changedFiles.add(file));
|
||||||
return;
|
|
||||||
|
|
||||||
queue = queue.then(async () => {
|
queue = queue.then(async () => {
|
||||||
|
if (changedFiles.size === 0)
|
||||||
|
return;
|
||||||
|
|
||||||
const { report } = await testServerConnection.listTests({ locations: options.files, projects: options.projects, grep: options.grep });
|
const { report } = await testServerConnection.listTests({ locations: options.files, projects: options.projects, grep: options.grep });
|
||||||
teleSuiteUpdater.processListReport(report);
|
teleSuiteUpdater.processListReport(report);
|
||||||
|
|
||||||
for (const test of teleSuiteUpdater.rootSuite!.allTests()) {
|
for (const test of teleSuiteUpdater.rootSuite!.allTests()) {
|
||||||
if (changedFiles.includes(test.location.file))
|
if (changedFiles.has(test.location.file))
|
||||||
dirtyTestIds.add(test.id);
|
dirtyTestIds.add(test.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// listTests can take longer than the debouncing interval of onTestFilesChanged,
|
changedFiles.clear();
|
||||||
// so the queue might contain another set of changed files to be processed before executing tests.
|
|
||||||
queue = queue.then(() => {
|
if (dirtyTestIds.size > 0)
|
||||||
if (dirtyTestIds.size > 0)
|
onDirtyTests.resolve?.();
|
||||||
onDirtyTests.resolve?.();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
testServerConnection.onReport(report => teleSuiteUpdater.processTestReportEvent(report));
|
testServerConnection.onReport(report => teleSuiteUpdater.processTestReportEvent(report));
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue