Skip to content

Commit

Permalink
Fix up playwright config
Browse files Browse the repository at this point in the history
  • Loading branch information
webpro committed Oct 12, 2023
1 parent d31a31a commit 1239eb3
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/plugins/playwright/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,14 @@ export const toEntryPatterns = (
return patterns.map(pattern => toEntryPattern(join(dir, pattern)));
};

const findPlaywrightDependencies: GenericPluginCallback = async (configFilePath, { cwd }) => {
const config: PlaywrightTestConfig = await load(configFilePath);
const projects = config.projects ? [config, ...config.projects] : [config];
const patterns = projects.flatMap(config => toEntryPatterns(config.testMatch, cwd, configFilePath, config));
if (patterns.length > 0) return patterns;
return toEntryPatterns(ENTRY_FILE_PATTERNS, cwd, configFilePath, config);
const findPlaywrightDependencies: GenericPluginCallback = async (configFilePath, { cwd, config }) => {
const cfg: PlaywrightTestConfig | undefined = await load(configFilePath);
if (cfg) {
const projects = cfg.projects ? [cfg, ...cfg.projects] : [cfg];
const patterns = projects.flatMap(config => toEntryPatterns(config.testMatch, cwd, configFilePath, config));
if (patterns.length > 0) return patterns;
}
return toEntryPatterns(config?.entry ?? ENTRY_FILE_PATTERNS, cwd, configFilePath, cfg ?? {});
};

export const findDependencies = timerify(findPlaywrightDependencies);

0 comments on commit 1239eb3

Please sign in to comment.