From 065f5ce7ecd8a32b7bbc3705fe45e9aaf0554730 Mon Sep 17 00:00:00 2001 From: Simon Knott Date: Mon, 22 Jul 2024 14:26:08 +0200 Subject: [PATCH] perform premature optimisation --- packages/playwright/src/runner/tasks.ts | 2 +- packages/playwright/src/runner/vcs.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/playwright/src/runner/tasks.ts b/packages/playwright/src/runner/tasks.ts index 923a831b04..503ee9953b 100644 --- a/packages/playwright/src/runner/tasks.ts +++ b/packages/playwright/src/runner/tasks.ts @@ -235,7 +235,7 @@ function createLoadTask(mode: 'out-of-process' | 'in-process', options: { filter for (const plugin of testRun.config.plugins) await plugin.instance?.populateDependencies?.(); const changedFiles = await detectChangedFiles(testRun.config.cliOnlyChanged); - cliOnlyChangedMatcher = file => changedFiles.includes(file); + cliOnlyChangedMatcher = file => changedFiles.has(file); } testRun.rootSuite = await createRootSuite(testRun, options.failOnLoadErrors ? errors : softErrors, !!options.filterOnly, cliOnlyChangedMatcher); diff --git a/packages/playwright/src/runner/vcs.ts b/packages/playwright/src/runner/vcs.ts index cc4ed18153..48d0cf3577 100644 --- a/packages/playwright/src/runner/vcs.ts +++ b/packages/playwright/src/runner/vcs.ts @@ -19,7 +19,7 @@ import { toPosixPath } from 'playwright-core/lib/utils'; import { affectedTestFiles } from '../transform/compilationCache'; import path from 'path'; -export async function detectChangedFiles(baseCommit: string): Promise { +export async function detectChangedFiles(baseCommit: string): Promise> { function gitFileList(command: string) { try { return childProcess.execSync( @@ -45,8 +45,8 @@ export async function detectChangedFiles(baseCommit: string): Promise const filesWithChanges = [...untrackedFiles, ...trackedFilesWithChanges]; const affectedFiles = affectedTestFiles(filesWithChanges); - return [ + return new Set([ ...filesWithChanges, ...affectedFiles, - ].map(toPosixPath); + ].map(toPosixPath)); } \ No newline at end of file