Skip to content

test(vitest): enable console enforcement and document env override#7986

Open
joshblack wants to merge 2 commits into
joshblack/fail-on-console/async-interaction-testsfrom
joshblack/fail-on-console/enable-console-enforcement
Open

test(vitest): enable console enforcement and document env override#7986
joshblack wants to merge 2 commits into
joshblack/fail-on-console/async-interaction-testsfrom
joshblack/fail-on-console/enable-console-enforcement

Conversation

@joshblack

@joshblack joshblack commented Jun 12, 2026

Copy link
Copy Markdown
Member

Enables the shared Vitest console enforcement by default for every Vitest project, and documents the VITEST_FAIL_ON_CONSOLE=false local debugging override in contributor docs and agent instructions.

Changelog

New

  • N/A

Changed

  • Vitest now fails by default when tests emit unexpected console output.
  • Added documentation for the fail-on-console environment variable helper in:
    • contributor-docs/testing.md
    • .github/copilot-instructions.md

Removed

  • N/A

Rollout strategy

  • Patch release
  • Minor release
  • Major release; if selected, include a written rollout or migration plan
  • None; test infrastructure + documentation updates only.

Testing & Reviewing

Validated with build, tests, type-check, lint, CSS lint, and format checks before the docs follow-up.
Validated docs follow-up with npm run lint and npm run format:diff.

Merge checklist

@changeset-bot

changeset-bot Bot commented Jun 12, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: b6b6345

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions github-actions Bot added staff Author is a staff member integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm labels Jun 12, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Action required

👋 Hi, this pull request contains changes to the source code that github/github-ui depends on. If you are GitHub staff, test these changes with github/github-ui using the integration workflow. Check the integration testing docs for step-by-step instructions. Or, apply the integration-tests: skipped manually label to skip these checks.

To publish a canary release for integration testing, apply the Canary Release label to this PR.

@joshblack joshblack added the skip changeset This change does not need a changelog label Jun 12, 2026
@joshblack joshblack changed the title Enable Vitest console enforcement test(vitest): enable console enforcement Jun 12, 2026
@github-actions github-actions Bot temporarily deployed to storybook-preview-7986 June 12, 2026 17:05 Inactive
@joshblack joshblack force-pushed the joshblack/fail-on-console/async-interaction-tests branch from b9480ad to 7f5f1bb Compare June 12, 2026 17:29
@joshblack joshblack force-pushed the joshblack/fail-on-console/enable-console-enforcement branch from 11c8e9e to f7c1568 Compare June 12, 2026 17:29
@github-actions github-actions Bot temporarily deployed to storybook-preview-7986 June 12, 2026 17:39 Inactive
@joshblack joshblack force-pushed the joshblack/fail-on-console/async-interaction-tests branch from 7f5f1bb to c892bf8 Compare June 12, 2026 18:31
@joshblack joshblack force-pushed the joshblack/fail-on-console/enable-console-enforcement branch from f7c1568 to 101e921 Compare June 12, 2026 18:31
@github-actions github-actions Bot temporarily deployed to storybook-preview-7986 June 12, 2026 18:46 Inactive
@joshblack joshblack marked this pull request as ready for review June 15, 2026 16:28
@joshblack joshblack requested a review from a team as a code owner June 15, 2026 16:28
@joshblack joshblack requested review from Copilot and siddharthkp June 15, 2026 16:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Vitest project configurations across the monorepo to enable the shared @primer/vitest-config console enforcement by default, while still allowing local opt-out via VITEST_FAIL_ON_CONSOLE=false.

Changes:

  • Flip the __VITEST_FAIL_ON_CONSOLE__ default from opt-in (=== 'true') to opt-out (!== 'false') across all Vitest project configs.
  • Apply the same behavior consistently for both node and browser Vitest projects.
Show a summary per file
File Description
packages/styled-react/vitest.config.ts Enable fail-on-console by default for styled-react node tests.
packages/styled-react/vitest.config.browser.ts Enable fail-on-console by default for styled-react browser tests.
packages/react/vitest.config.mts Enable fail-on-console by default for react node tests.
packages/react/vitest.config.browser.mts Enable fail-on-console by default for react browser tests.
packages/postcss-preset-primer/vitest.config.ts Enable fail-on-console by default for postcss-preset-primer tests.
packages/doc-gen/vitest.config.mts Enable fail-on-console by default for doc-gen tests.

Copilot's findings

  • Files reviewed: 6/6 changed files
  • Comments generated: 0

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@joshblack joshblack force-pushed the joshblack/fail-on-console/async-interaction-tests branch from c892bf8 to 6556f51 Compare June 15, 2026 16:37
@joshblack joshblack force-pushed the joshblack/fail-on-console/enable-console-enforcement branch from 101e921 to 34287ea Compare June 15, 2026 16:37
@joshblack

Copy link
Copy Markdown
Member Author

@copilot can you add docs for this to agent instructions and contributor docs? Specifically the fail on console ENV helper

Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>

Copilot AI commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

@copilot can you add docs for this to agent instructions and contributor docs? Specifically the fail on console ENV helper

Done in b6b6345.

I added docs for the fail-on-console ENV helper in:

  • .github/copilot-instructions.md (agent instructions)
  • contributor-docs/testing.md (contributor testing docs)

Both now document that console enforcement is on by default and that VITEST_FAIL_ON_CONSOLE=false can be used for local debugging.

Copilot AI changed the title test(vitest): enable console enforcement test(vitest): enable console enforcement and document env override Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm skip changeset This change does not need a changelog staff Author is a staff member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants