fix project filter test

This commit is contained in:
Simon Knott 2024-09-16 10:47:51 +02:00
parent b4707ca82e
commit 52a6bdb803
No known key found for this signature in database
GPG key ID: 8CEDC00028084AEC
2 changed files with 7 additions and 3 deletions

View file

@ -119,7 +119,7 @@ export async function runWatchModeLoop(configLocation: ConfigLocation, initialOp
}
changedFiles.clear();
if (dirtyTestIds.size > 0) {
if (dirtyTestIds.size > 0) {
onDirtyTests.resolve('changed');
onDirtyTests = new ManualPromise();
}
@ -144,10 +144,9 @@ export async function runWatchModeLoop(configLocation: ConfigLocation, initialOp
else
printPrompt();
const readCommandPromise = readCommand();
const command = await Promise.race([
onDirtyTests,
readCommandPromise,
readCommand(),
]);
if (bufferMode && command === 'changed')

View file

@ -313,12 +313,17 @@ test('should respect project filter C', async ({ runWatchTest, writeFiles }) =>
await testProcess.waitForOutput('[foo] a.test.ts:3:11 passes');
expect(testProcess.output).not.toContain('[bar] a.test.ts:3:11 passes');
await testProcess.waitForOutput('Waiting for file changes.');
testProcess.clearOutput();
await writeFiles(files); // file change triggers listTests with project filter
await testProcess.waitForOutput('[foo] a.test.ts:3:11 passes');
testProcess.clearOutput();
await testProcess.waitForOutput('Waiting for file changes.');
testProcess.write('c');
testProcess.clearOutput();
await testProcess.waitForOutput('Select projects');
await testProcess.waitForOutput('foo');
await testProcess.waitForOutput('bar'); // second selection should still show all