populate on setup

This commit is contained in:
Simon Knott 2025-05-23 15:42:47 +02:00
parent 4b68edbcf4
commit fc07052d57
No known key found for this signature in database
GPG Key ID: 8CEDC00028084AEC

View File

@ -44,17 +44,7 @@ const gitCommitInfoPlugin = (fullConfig: FullConfigInternal): TestRunnerPlugin =
let config: FullConfig; let config: FullConfig;
const configDir = fullConfig.configDir; const configDir = fullConfig.configDir;
return { async function updateMetdata() {
name: 'playwright:git-commit-info',
setup: async (cfg: FullConfig) => {
config = cfg;
},
begin: async () => {
if (!config)
throw new Error('Configuration is missing');
const metadata = config.metadata as MetadataWithCommitInfo; const metadata = config.metadata as MetadataWithCommitInfo;
const ci = await ciInfo(); const ci = await ciInfo();
@ -80,6 +70,21 @@ const gitCommitInfoPlugin = (fullConfig: FullConfigInternal): TestRunnerPlugin =
} }
} }
} }
let testRun = 0;
return {
name: 'playwright:git-commit-info',
setup: async (cfg: FullConfig) => {
config = cfg;
await updateMetdata();
},
begin: async () => {
testRun++;
if (testRun > 1)
await updateMetdata();
}
}; };
}; };