Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ The primary workspace is `packages/react` which contains the `@primer/react` pac
**Run tests:**

- `npm test` -- runs unit tests. NEVER CANCEL. Takes 75 seconds. Set timeout to 90+ minutes. Runs 1500+ tests using Vitest in both node and chromium environments.
- Vitest console enforcement is enabled by default. For local debugging, temporarily opt out with `VITEST_FAIL_ON_CONSOLE=false npm test`.
- `npm run type-check` -- runs TypeScript type checking across all packages. Takes 42 seconds. Set timeout to 60+ minutes.

**Development workflow:**
Expand Down
2 changes: 2 additions & 0 deletions contributor-docs/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ We are slowly moving away from using snapshots as a way to test visual changes o
| Run a specific test | `npm test ComponentName` |
| Update snapshots | `npm test -- -u` |

By default, Vitest fails when tests emit unexpected console output. For local debugging, you can temporarily disable this enforcement with `VITEST_FAIL_ON_CONSOLE=false`.

## Interaction Tests

### As A Part Of Unit Tests
Expand Down
2 changes: 1 addition & 1 deletion packages/doc-gen/vitest.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {defineConfig} from 'vitest/config'
export default defineConfig({
define: {
__DEV__: true,
__VITEST_FAIL_ON_CONSOLE__: JSON.stringify(process.env.VITEST_FAIL_ON_CONSOLE === 'true'),
__VITEST_FAIL_ON_CONSOLE__: JSON.stringify(process.env.VITEST_FAIL_ON_CONSOLE !== 'false'),
},
test: {
environment: 'node',
Expand Down
2 changes: 1 addition & 1 deletion packages/postcss-preset-primer/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {defineConfig} from 'vitest/config'

export default defineConfig({
define: {
__VITEST_FAIL_ON_CONSOLE__: JSON.stringify(process.env.VITEST_FAIL_ON_CONSOLE === 'true'),
__VITEST_FAIL_ON_CONSOLE__: JSON.stringify(process.env.VITEST_FAIL_ON_CONSOLE !== 'false'),
},
test: {
environment: 'node',
Expand Down
2 changes: 1 addition & 1 deletion packages/react/vitest.config.browser.mts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default defineConfig({
],
define: {
__DEV__: true,
__VITEST_FAIL_ON_CONSOLE__: JSON.stringify(process.env.VITEST_FAIL_ON_CONSOLE === 'true'),
__VITEST_FAIL_ON_CONSOLE__: JSON.stringify(process.env.VITEST_FAIL_ON_CONSOLE !== 'false'),
'process.env.CI': JSON.stringify(process.env.CI),
},
test: {
Expand Down
2 changes: 1 addition & 1 deletion packages/react/vitest.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default defineConfig({
],
define: {
__DEV__: true,
__VITEST_FAIL_ON_CONSOLE__: JSON.stringify(process.env.VITEST_FAIL_ON_CONSOLE === 'true'),
__VITEST_FAIL_ON_CONSOLE__: JSON.stringify(process.env.VITEST_FAIL_ON_CONSOLE !== 'false'),
},
test: {
name: '@primer/react (node)',
Expand Down
2 changes: 1 addition & 1 deletion packages/styled-react/vitest.config.browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default defineConfig({
plugins: [react()],
define: {
__DEV__: true,
__VITEST_FAIL_ON_CONSOLE__: JSON.stringify(process.env.VITEST_FAIL_ON_CONSOLE === 'true'),
__VITEST_FAIL_ON_CONSOLE__: JSON.stringify(process.env.VITEST_FAIL_ON_CONSOLE !== 'false'),
},
resolve: {
alias: [
Expand Down
2 changes: 1 addition & 1 deletion packages/styled-react/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {defineConfig} from 'vitest/config'

export default defineConfig({
define: {
__VITEST_FAIL_ON_CONSOLE__: JSON.stringify(process.env.VITEST_FAIL_ON_CONSOLE === 'true'),
__VITEST_FAIL_ON_CONSOLE__: JSON.stringify(process.env.VITEST_FAIL_ON_CONSOLE !== 'false'),
},
test: {
name: '@primer/styled-react (node)',
Expand Down
Loading