diff --git a/docs/src/test-api/class-testconfig.md b/docs/src/test-api/class-testconfig.md index 5b89e62b88..5515252b39 100644 --- a/docs/src/test-api/class-testconfig.md +++ b/docs/src/test-api/class-testconfig.md @@ -334,6 +334,8 @@ Whether to populate `'git.commit.info'` field of the [`property: TestConfig.meta This information will appear in the HTML and JSON reports and is available in the Reporter API. +On Github Actions, this feature is enabled by default. + **Usage** ```js title="playwright.config.ts" diff --git a/packages/playwright/src/common/config.ts b/packages/playwright/src/common/config.ts index b0bc394873..59d1973578 100644 --- a/packages/playwright/src/common/config.ts +++ b/packages/playwright/src/common/config.ts @@ -78,7 +78,7 @@ export class FullConfigInternal { const privateConfiguration = (userConfig as any)['@playwright/test']; this.plugins = (privateConfiguration?.plugins || []).map((p: any) => ({ factory: p })); this.singleTSConfigPath = pathResolve(configDir, userConfig.tsconfig); - this.populateGitInfo = takeFirst(userConfig.populateGitInfo, false); + this.populateGitInfo = takeFirst(userConfig.populateGitInfo, defaultPopulateGitInfo); this.globalSetups = (Array.isArray(userConfig.globalSetup) ? userConfig.globalSetup : [userConfig.globalSetup]).map(s => resolveScript(s, configDir)).filter(script => script !== undefined); this.globalTeardowns = (Array.isArray(userConfig.globalTeardown) ? userConfig.globalTeardown : [userConfig.globalTeardown]).map(s => resolveScript(s, configDir)).filter(script => script !== undefined); @@ -301,6 +301,7 @@ function resolveScript(id: string | undefined, rootDir: string): string | undefi export const defaultGrep = /.*/; export const defaultReporter = process.env.CI ? 'dot' : 'list'; +const defaultPopulateGitInfo = process.env.GITHUB_ACTIONS === 'true'; const configInternalSymbol = Symbol('configInternalSymbol'); diff --git a/packages/playwright/types/test.d.ts b/packages/playwright/types/test.d.ts index ab23b480b2..a31bb858d5 100644 --- a/packages/playwright/types/test.d.ts +++ b/packages/playwright/types/test.d.ts @@ -1367,6 +1367,8 @@ interface TestConfig { * * This information will appear in the HTML and JSON reports and is available in the Reporter API. * + * On Github Actions, this feature is enabled by default. + * * **Usage** * * ```js diff --git a/tests/playwright-test/playwright-test-fixtures.ts b/tests/playwright-test/playwright-test-fixtures.ts index 5d6aab5b8e..789ed1feb6 100644 --- a/tests/playwright-test/playwright-test-fixtures.ts +++ b/tests/playwright-test/playwright-test-fixtures.ts @@ -222,6 +222,7 @@ export function cleanEnv(env: NodeJS.ProcessEnv): NodeJS.ProcessEnv { CI_COMMIT_SHA: undefined, CI_JOB_URL: undefined, CI_PROJECT_URL: undefined, + GITHUB_ACTIONS: undefined, GITHUB_REPOSITORY: undefined, GITHUB_RUN_ID: undefined, GITHUB_SERVER_URL: undefined,