Skip to content

Commit

Permalink
chore(test): exclude the github reporter from playwright tests for now (
Browse files Browse the repository at this point in the history
  • Loading branch information
bjoerge authored Mar 12, 2024
1 parent 15f53bd commit 334917f
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {defineConfig} from '@playwright/test'
import {defineConfig, type PlaywrightTestConfig} from '@playwright/test'
import {createPlaywrightConfig} from '@sanity/test'

import {loadEnvFiles} from './scripts/utils/loadEnvFiles'
Expand All @@ -8,12 +8,24 @@ loadEnvFiles()

const CI = readBoolEnv('CI', false)

/**
* Excludes the GitHub reporter until https://github.com/microsoft/playwright/issues/19817 is resolved, since it creates a lot of noise in our PRs.
* @param reporters - The reporters config to exclude the github reporter from
*/
function excludeGithub(reporters: PlaywrightTestConfig['reporter']) {
if (Array.isArray(reporters)) {
return reporters.filter((reporterDescription) => reporterDescription[0] !== 'github')
}
return reporters === 'github' ? undefined : reporters
}

const playwrightConfig = createPlaywrightConfig({
projectId: readEnv('SANITY_E2E_PROJECT_ID'),
token: readEnv('SANITY_E2E_SESSION_TOKEN'),
playwrightOptions(config) {
return {
...config,
reporter: excludeGithub(config.reporter),
use: {
...config.use,
baseURL: 'http://localhost:3339',
Expand Down

0 comments on commit 334917f

Please sign in to comment.