Skip to content
Merged
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
66 changes: 66 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Contributing

Thanks for considering contributing to this project. Ways you can help:

- [Create a pull request](https://help.github.com/articles/creating-a-pull-request)

Copilot AI Apr 30, 2026

Copy link

Choose a reason for hiding this comment

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

The GitHub Help URL here is deprecated (help.github.com). Please update the link to the current docs.github.com page for creating a pull request so it doesn't break or redirect unexpectedly.

Suggested change
- [Create a pull request](https://help.github.com/articles/creating-a-pull-request)
- [Create a pull request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request)

Copilot uses AI. Check for mistakes.
- [Add an issue](https://github.com/braintree/class-list/issues)

## Development

Clone this repo, then install the project's dependencies:

```
npm install
```

## Tests

```
npm test
```

### Test Stability, Quarantine & Remediation Policy

Flaky tests are any test that passes and fails intermittently without code changes (this could be due to things like timeouts, inconsistent return values, poor assertions, etc). Flaky tests erode confidence in the test suite and slow down development. This section defines how we detect, quarantine, and remediate them.

Copilot AI Apr 30, 2026

Copy link

Choose a reason for hiding this comment

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

Minor grammar: "Flaky tests are any test" should be rephrased (e.g., "A flaky test is a test..." or "Flaky tests are tests...") to read correctly.

Suggested change
Flaky tests are any test that passes and fails intermittently without code changes (this could be due to things like timeouts, inconsistent return values, poor assertions, etc). Flaky tests erode confidence in the test suite and slow down development. This section defines how we detect, quarantine, and remediate them.
A flaky test is a test that passes and fails intermittently without code changes (this could be due to things like timeouts, inconsistent return values, poor assertions, etc). Flaky tests erode confidence in the test suite and slow down development. This section defines how we detect, quarantine, and remediate them.

Copilot uses AI. Check for mistakes.

#### Detection

- **Automatic retries**: Jest unit tests can be configured to automatically retry on failure via `jest.retryTimes()`. Playwright integration tests (where applicable) have retries configured per-project. A test that fails once but passes on retry can be considered as potentially flaky.

Copilot AI Apr 30, 2026

Copy link

Choose a reason for hiding this comment

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

This repo doesn't appear to use Playwright (no dependency/config found). Mentioning Playwright retries here is likely confusing—either remove the Playwright reference or replace it with the actual integration/e2e test tooling used in this project.

Suggested change
- **Automatic retries**: Jest unit tests can be configured to automatically retry on failure via `jest.retryTimes()`. Playwright integration tests (where applicable) have retries configured per-project. A test that fails once but passes on retry can be considered as potentially flaky.
- **Automatic retries**: Jest unit tests can be configured to automatically retry on failure via `jest.retryTimes()`. A test that fails once but passes on retry can be considered as potentially flaky.

Copilot uses AI. Check for mistakes.
- **Repeat failures**: If a test fails intermittently across multiple CI runs or PRs, it should be reported by opening a GitHub issue with the `flaky-test` label. Include the test name, file path, failure frequency, and any relevant error output.

#### Quarantine

When a test is confirmed flaky:

1. **Open a tracking issue** in GitHub Issues. Use the `flaky-test` label and include:
- Test file path and test name
- Observed failure rate and pattern (e.g., "fails ~10% of runs", "only in CI")
- Stack trace or error message
2. **Skip the test** using `.skip` and add a comment referencing the tracking issue:

```javascript
// Quarantined: flaky due to timing sensitivity (https://github.com/braintree/class-list/issues/123)
it.skip("should handle the edge case", function () {
// ...
});
```

For `describe` blocks with multiple flaky tests, you may quarantine the entire block:

```javascript
// Quarantined: intermittent failures under load (https://github.com/braintree/class-list/issues/123)
describe.skip("feature under investigation", function () {
// ...
});
```

3. **Skipped tests are excluded from coverage reporting.** Since quarantined tests do not execute, their associated source code is not counted toward coverage metrics. This is expected and acceptable while the test is in quarantine.

Copilot AI Apr 30, 2026

Copy link

Choose a reason for hiding this comment

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

The statement that skipped tests are "excluded from coverage reporting" is inaccurate for the current Jest setup (collectCoverageFrom includes all src files). Skipping a test usually means less code gets executed and coverage can drop (and potentially fail the configured coverageThreshold). Please reword to reflect how coverage works here and what maintainers should expect when quarantining tests.

Suggested change
3. **Skipped tests are excluded from coverage reporting.** Since quarantined tests do not execute, their associated source code is not counted toward coverage metrics. This is expected and acceptable while the test is in quarantine.
3. **Skipped tests do not run, so coverage may decrease.** In this Jest setup, coverage reporting still includes the configured source files even when a quarantined test is skipped. Because the skipped test no longer exercises its code paths, overall coverage can drop and may cause the configured `coverageThreshold` to fail. Maintainers should expect this when quarantining a test and either remediate the test promptly or make any necessary coverage-related follow-up as part of the quarantine plan.

Copilot uses AI. Check for mistakes.

#### Remediation SLA

Quarantined tests must be remedied within **30 days** of being quarantined. Remediation means one of the following:

- **Fixed**: The root cause is identified and corrected, the `.skip` is removed, and the test passes reliably.
- **Deleted**: If the test is no longer valuable or the feature it covers has changed, delete the test and close the tracking issue.

If a quarantined test exceeds **14 days** without progress, it should be escalated and prioritized. Tests that remain skipped indefinitely are not acceptable.
Loading