chore(ct): replace find-related-test-files hook with populateDependencies
This commit is contained in:
parent
c74843a914
commit
2d8c3d6800
|
|
@ -32,7 +32,6 @@ const defineConfig = (...configs) => {
|
||||||
cli: {
|
cli: {
|
||||||
'clear-cache': clearCacheCommand,
|
'clear-cache': clearCacheCommand,
|
||||||
'dev-server': runDevServerCommand,
|
'dev-server': runDevServerCommand,
|
||||||
'find-related-test-files': findRelatedTestFilesCommand,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { affectedTestFiles, cacheDir } from 'playwright/lib/transform/compilationCache';
|
import { cacheDir } from 'playwright/lib/transform/compilationCache';
|
||||||
import { buildBundle } from './vitePlugin';
|
|
||||||
import { resolveDirs } from './viteUtils';
|
import { resolveDirs } from './viteUtils';
|
||||||
import { runDevServer } from './devServer';
|
import { runDevServer } from './devServer';
|
||||||
import type { FullConfigInternal } from 'playwright/lib/common/config';
|
import type { FullConfigInternal } from 'playwright/lib/common/config';
|
||||||
|
|
@ -29,11 +28,6 @@ export async function clearCacheCommand(config: FullConfigInternal) {
|
||||||
await removeFolderAndLogToConsole(cacheDir);
|
await removeFolderAndLogToConsole(cacheDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function findRelatedTestFilesCommand(files: string[], config: FullConfigInternal) {
|
|
||||||
await buildBundle(config.config, config.configDir);
|
|
||||||
return { testFiles: affectedTestFiles(files) };
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function runDevServerCommand(config: FullConfigInternal) {
|
export async function runDevServerCommand(config: FullConfigInternal) {
|
||||||
return await runDevServer(config);
|
return await runDevServer(config);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -143,9 +143,8 @@ export class Runner {
|
||||||
return { errors: result.errors, testFiles: [] };
|
return { errors: result.errors, testFiles: [] };
|
||||||
|
|
||||||
const resolvedFiles = (files as string[]).map(file => path.resolve(process.cwd(), file));
|
const resolvedFiles = (files as string[]).map(file => path.resolve(process.cwd(), file));
|
||||||
const override = (this._config.config as any)['@playwright/test']?.['cli']?.['find-related-test-files'];
|
for (const plugin of this._config.plugins)
|
||||||
if (override)
|
await plugin.instance?.populateDependencies?.();
|
||||||
return await override(resolvedFiles, this._config);
|
|
||||||
return { testFiles: affectedTestFiles(resolvedFiles) };
|
return { testFiles: affectedTestFiles(resolvedFiles) };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue