properly clear dirtyTestFiles
This commit is contained in:
parent
989c9a2d5a
commit
c26c6593e2
|
|
@ -92,7 +92,7 @@ export async function runWatchModeLoop(configLocation: ConfigLocation, initialOp
|
||||||
|
|
||||||
const telesuiteUpdater = new TeleSuiteUpdater({ pathSeparator: path.sep, onUpdate() { } });
|
const telesuiteUpdater = new TeleSuiteUpdater({ pathSeparator: path.sep, onUpdate() { } });
|
||||||
|
|
||||||
const dirtyTestFiles: string[] = []; // we're never clearing this! seems wrong.
|
const dirtyTestFiles = new Set<string>();
|
||||||
const onDirtyTestFiles: { resolve?(): void } = {};
|
const onDirtyTestFiles: { resolve?(): void } = {};
|
||||||
|
|
||||||
testServerConnection.onTestFilesChanged(async ({ testFiles: changedFiles }) => {
|
testServerConnection.onTestFilesChanged(async ({ testFiles: changedFiles }) => {
|
||||||
|
|
@ -105,11 +105,11 @@ export async function runWatchModeLoop(configLocation: ConfigLocation, initialOp
|
||||||
for (const project of telesuiteUpdater.rootSuite!.suites) {
|
for (const project of telesuiteUpdater.rootSuite!.suites) {
|
||||||
for (const suite of project.suites) {
|
for (const suite of project.suites) {
|
||||||
if (suite.location?.file && changedFiles.includes(suite.location.file))
|
if (suite.location?.file && changedFiles.includes(suite.location.file))
|
||||||
dirtyTestFiles.push(suite.location.file);
|
dirtyTestFiles.add(suite.location.file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dirtyTestFiles.length === 0)
|
if (dirtyTestFiles.size === 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
onDirtyTestFiles.resolve?.();
|
onDirtyTestFiles.resolve?.();
|
||||||
|
|
@ -141,8 +141,10 @@ export async function runWatchModeLoop(configLocation: ConfigLocation, initialOp
|
||||||
const command = await readCommandPromise;
|
const command = await readCommandPromise;
|
||||||
|
|
||||||
if (command === 'changed') {
|
if (command === 'changed') {
|
||||||
await runChangedTests(options, testServerConnection, dirtyTestFiles);
|
const changedFiles = [...dirtyTestFiles];
|
||||||
lastRun = { type: 'changed', dirtyTestFiles: [...dirtyTestFiles] };
|
dirtyTestFiles.clear();
|
||||||
|
await runChangedTests(options, testServerConnection, changedFiles);
|
||||||
|
lastRun = { type: 'changed', dirtyTestFiles: changedFiles };
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -419,6 +419,17 @@ test('should run on changed files', async ({ runWatchTest, writeFiles }) => {
|
||||||
expect(testProcess.output).not.toContain('a.test.ts:3:11 › passes');
|
expect(testProcess.output).not.toContain('a.test.ts:3:11 › passes');
|
||||||
expect(testProcess.output).not.toContain('b.test.ts:3:11 › passes');
|
expect(testProcess.output).not.toContain('b.test.ts:3:11 › passes');
|
||||||
await testProcess.waitForOutput('Waiting for file changes.');
|
await testProcess.waitForOutput('Waiting for file changes.');
|
||||||
|
|
||||||
|
testProcess.clearOutput();
|
||||||
|
await writeFiles({
|
||||||
|
'b.test.ts': `
|
||||||
|
import { test, expect } from '@playwright/test';
|
||||||
|
test('passes', () => {});
|
||||||
|
`,
|
||||||
|
});
|
||||||
|
|
||||||
|
await testProcess.waitForOutput('b.test.ts:3:11 › passes');
|
||||||
|
expect(testProcess.output).not.toContain('c.test.ts:3:11 › passes');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should run on changed deps', async ({ runWatchTest, writeFiles }) => {
|
test('should run on changed deps', async ({ runWatchTest, writeFiles }) => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue