fix: run updateList before determining what tests changed

This commit is contained in:
Simon Knott 2024-07-24 15:53:52 +02:00
parent 01a0024ce7
commit 504cb0a823
No known key found for this signature in database
GPG key ID: 8CEDC00028084AEC
2 changed files with 9 additions and 4 deletions

View file

@ -314,9 +314,14 @@ export const UIModeView: React.FC<{}> = ({
// Watch implementation.
React.useEffect(() => {
if (!testServerConnection)
if (!testServerConnection || !teleSuiteUpdater)
return;
const disposable = testServerConnection.onTestFilesChanged(params => {
const disposable = testServerConnection.onTestFilesChanged(async params => {
await updateList();
const testModel = teleSuiteUpdater.asModel();
const testTree = new TestTree('', testModel.rootSuite, testModel.loadErrors, projectFilters, pathSeparator);
const testIds: string[] = [];
const set = new Set(params.testFiles);
if (watchAll) {
@ -339,7 +344,7 @@ export const UIModeView: React.FC<{}> = ({
runTests('queue-if-busy', new Set(testIds));
});
return () => disposable.dispose();
}, [runTests, testServerConnection, testTree, watchAll, watchedTreeIds]);
}, [runTests, updateList, testServerConnection, watchAll, watchedTreeIds, teleSuiteUpdater, projectFilters]);
// Shortcuts.
React.useEffect(() => {

View file

@ -245,7 +245,7 @@ test('should run added test in watched file', async ({ runUITest, writeFiles })
});
await expect.poll(dumpTestTree(page)).toBe(`
a.test.ts 👁 <=
a.test.ts 👁 <=
foo
bar
`);