flakefinder 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +32 -57
  2. package/dist/cli.js +1709 -1239
  3. package/package.json +7 -1
package/README.md CHANGED
@@ -33,8 +33,8 @@ a run with only retry-rescued tests from one with failures still present.
33
33
 
34
34
  **HISTORY — `flakefinder ingest` / `report` / `html`**
35
35
  Every parsed run lands in an append-only JSONL store (`.flakefinder/history.jsonl`).
36
- The engine replays each test's timeline and classifies it: same-commit flips
37
- (failed *and* passed on one commit — the strongest possible signal), retry
36
+ The engine replays each test's timeline. Same-commit flips
37
+ (a failure and a pass on one commit), retry
38
38
  rescues, and flip-flop patterns across commits (or across runs, when no git
39
39
  metadata exists) each count toward a 0–100 flake score with a confidence
40
40
  value. Weeks of CI runs turn into a ranked list of worst offenders.
@@ -43,10 +43,10 @@ value. Weeks of CI runs turn into a ranked list of worst offenders.
43
43
 
44
44
  | Verdict | Meaning |
45
45
  |---|---|
46
- | `FLAKY (confirmed)` | observed both a failure and a pass on the same commit |
46
+ | `FLAKY (confirmed)` | observed a failure and a pass on the same code state |
47
47
  | `FLAKY (retry-rescued)` | failed, then passed on a retry of the same run |
48
48
  | `FLAKY (suspected)` | result flipped ≥ 2 times across commits/runs; score-gated |
49
- | `FAILING` | last 5 observations all failed |
49
+ | `FAILING` | last five observed runs all failed, or all available runs if fewer than five, with at least `minRuns` |
50
50
  | `NEW FAILURE` | failed on the latest run, not enough data yet to say more |
51
51
  | passing / skipped / gone | healthy, always-skipped, not seen in 30 runs |
52
52
 
@@ -56,8 +56,8 @@ median), `recently-fixed` (failed historically, stably passing now),
56
56
 
57
57
  ## Quickstart
58
58
 
59
- Your test runner must emit a machine-readable report (one flag — see the
60
- table below). Then:
59
+ Configure your test runner to emit a machine-readable report using the
60
+ table below. For example, with Jest:
61
61
 
62
62
  ```console
63
63
  $ npx flakefinder init
@@ -75,48 +75,28 @@ flakefinder: attempt 2/3 → npm test
75
75
  flakefinder: attempt 3/3 → npm test
76
76
  … the other test still fails on the final attempt …
77
77
 
78
- flakefinder — 5 tracked test(s), 2 need attention
79
-
80
- FLAKY (confirmed) — 1
81
- 90 conf 100% runs 3 pass 33% med 1ms flaky-counter fails on odd counts :: flaky-counter fails on odd counts
82
-
83
- FAILING — 1
84
- 0 conf 40% runs 3 pass 0% med 2ms always-fail fails deterministically :: always-fail fails deterministically
85
-
86
- ok: 3 passing · 0 skipped · 0 gone from recent runs
87
-
88
- next steps:
89
- • quarantine the worst offender:
90
- flakefinder quarantine add b6930d21e68e49f7
91
- • full interactive report: flakefinder html
92
-
93
- $ echo $?
94
- 1 # a failure persisted through the final attempt
78
+ … flakefinder reports the recovered test and the remaining failure …
79
+ … the command exits with status 1 …
95
80
 
96
81
  $ npx flakefinder report # terminal table from accumulated history
97
82
  $ npx flakefinder report --flakes-only --no-color # CI-friendly, problems only
98
83
  $ npx flakefinder html # writes flakefinder-report.html — open it
99
84
  ```
100
85
 
101
- <!-- TODO: screenshot: terminal report -->
102
-
103
- The sample above is the real output of this repo's jest fixture
104
- (`fixtures/jest-project`), where `flaky-counter` fails on odd invocations by
105
- design and `always-fail` never passes.
106
-
107
- <!-- TODO: screenshot: dashboard -->
86
+ The excerpt illustrates the Jest fixture in `fixtures/jest-project`. Its
87
+ `flaky-counter` fails on odd invocations, and `always-fail` fails every time.
108
88
 
109
89
  ## Supported report formats
110
90
 
111
91
  | Format | Runners | How to make your runner emit it |
112
92
  |---|---|---|
113
93
  | JUnit XML | pytest, Jest (jest-junit), vitest (junit reporter), Maven/surefire, anything JUnit-shaped | pytest: `--junitxml=junit.xml` · jest: `reporters: ['default', ['jest-junit', { outputDirectory: '.', outputName: 'junit.xml' }]]` |
114
- | Jest JSON | Jest, vitest (`--json` stream) | `jest --json --outputFile=jest.json` (flakefinder also accepts jest-junit XML) |
94
+ | Jest-compatible JSON | Jest, Vitest | Jest `jest --json --outputFile=jest.json` or Vitest `vitest run --reporter=json --outputFile=jest.json` |
115
95
  | Mocha JSON | Mocha, mocha-wrapper runners | `mocha --reporter json --reporter-options output=test-results/report.json` |
116
96
  | go test -json | Go | `go test -json ./... > test-output.jsonl` (add `-count=1` to defeat Go's result cache) |
117
97
  | TAP | node:test (`--test-reporter=tap`), TAP14 producers | `node --test --test-reporter=tap > tap.txt` |
118
98
  | TRX | .NET (`dotnet test`), VSTest | `dotnet test --logger "trx;LogFileName=results.trx"` |
119
- | Playwright JSON | Playwright (per-attempt retries) | `PLAYWRIGHT_JSON_OUTPUT_NAME=pw.json npx playwright test --reporter=json` |
99
+ | Playwright JSON | Playwright (per-attempt retries) | `npx playwright test --reporter=json > pw.json` |
120
100
  | pytest-json-report | pytest with the `pytest-json-report` plugin | `pytest --json-report --json-report-file=report.json` |
121
101
 
122
102
  Reports may be UTF-8 or UTF-16 (e.g. PowerShell `>` output) and may be gzip-compressed.
@@ -129,7 +109,7 @@ repo are fine. Point `flakefinder.config.json` → `reports` globs at them.
129
109
  ```yaml
130
110
  - run: npm test # your tests write report files
131
111
  - name: flakefinder
132
- uses: DJJW26/flakefinder@f1bc4dd92ad2a11ac49d74d7ac272f9f25e11d7f
112
+ uses: DJJW26/flakefinder@024fccee61b5ac58e18adf35e2739c7231192e64 # v1.2.0
133
113
  if: always()
134
114
  with:
135
115
  fail-on-new-flakes: 'false'
@@ -142,22 +122,17 @@ separate histories automatically. Full input/output reference, matrix and
142
122
  monorepo recipes: [docs/github-action.md](docs/github-action.md).
143
123
 
144
124
  Start with reporting and review the results from your own suite before
145
- enabling `fail-on-new-flakes`. The example pins a full commit SHA from `main`
146
- so each workflow run uses the same Action code.
125
+ enabling `fail-on-new-flakes`. The example pins the commit tagged `v1.2.0`.
147
126
 
148
127
  ## Quarantine
149
128
 
150
- ```console
151
- $ npx flakefinder quarantine add b6930d21e68e49f7 --reason "order-dependent"
152
- quarantined flaky-counter fails on odd counts :: flaky-counter fails on odd counts (flaky-confirmed, score 90)
129
+ Replace `YOUR_TEST_ID` with the ID from `flakefinder report --format json`.
153
130
 
131
+ ```console
132
+ $ npx flakefinder quarantine add YOUR_TEST_ID --reason "order-dependent"
154
133
  $ npx flakefinder quarantine list
155
- 1 quarantined test(s):
156
- b6930d21e68e49f7 flaky-counter fails on odd counts :: flaky-counter fails on odd counts (score 90, order-dependent)
157
- next run will add: -t ^(?!.*(?:flaky-counter fails on odd counts))
158
-
159
- $ npx flakefinder run -- npm test # quarantined tests are now excluded
160
- $ npx flakefinder quarantine remove b6930d21e68e49f7
134
+ $ npx flakefinder run -- npm test # supported runners exclude the quarantined tests
135
+ $ npx flakefinder quarantine remove YOUR_TEST_ID
161
136
  $ npx flakefinder quarantine prune # releases entries with positive evidence of health
162
137
  ```
163
138
 
@@ -184,14 +159,13 @@ tracked and reported, but not auto-excluded.
184
159
 
185
160
  **How much overhead does `run` add?**
186
161
  Retries run only after a failed attempt. By default, supported runners retry
187
- just the failed tests and other runners retry the full command. A green suite
188
- runs once. Set the retry limit with `-R` or `liveRetries`, or ingest reports
162
+ just the failed tests when the reports identify them. Other retries rerun the
163
+ full command. A green suite runs once. Set the retry limit with `-R` or `liveRetries`, or ingest reports
189
164
  directly to skip live retries.
190
165
 
191
166
  **What happens when tests get renamed?**
192
- Identity is `sha256(suite + name)`, so a rename forks history: the old test
193
- goes `gone`, the new one starts fresh. Live with it by renaming deliberately
194
- (fresh history is honest), or keep names stable and change the *assertions*.
167
+ A rename starts a new history. See the usage guide for file and report scopes
168
+ available in `1.2.1` and later. [Test identity](docs/USAGE.md#test-identity)
195
169
 
196
170
  **Monorepo support?**
197
171
  Yes — run each package with `--cwd <dir>` (config, reports, and store resolve
@@ -199,16 +173,16 @@ relative to it), or use the Action's `working-directory` input. Each package
199
173
  keeps its own history store.
200
174
 
201
175
  **Does it modify my tests or my runner config?**
202
- No. `init` writes one new file (`flakefinder.config.json`), `run` only reads
203
- report files your runner writes, and quarantine works by appending runner
204
- flags — never by editing sources. The one thing you must do yourself is turn
205
- on machine-readable reports (one flag, shown in the table above).
176
+ `init` creates `flakefinder.config.json`. `run` invokes your command, reads its
177
+ reports, and saves history. Quarantine applies runner filters. Configure your
178
+ test runner to write reports using the supported formats above.
206
179
 
207
180
  **Where does my data live, and who can see it?**
208
- `.flakefinder/history.jsonl` next to your config — plain JSON Lines, one run
209
- per line. `cat` it, grep it, delete it, gitignore it (init reminders do).
210
- Nothing is uploaded anywhere unless you use the GitHub Action, in which case
211
- history lives in your repository's actions cache.
181
+ By default the CLI writes `.flakefinder/history.jsonl` under the working
182
+ directory. Multiple records can belong to one run. The Action stores history
183
+ in GitHub Actions cache and can publish PR comments and a dashboard artifact.
184
+ With GitLab credentials configured, `flakefinder ci` can post an MR note.
185
+ See the [privacy details](docs/USAGE.md#privacy).
212
186
 
213
187
  **Does it work with runner X?**
214
188
  If X can emit JUnit XML, Jest JSON, Mocha JSON, `go test -json`, TAP, TRX,
@@ -230,6 +204,7 @@ pipeline: run → retries → classify → report → dashboard → quarantine.
230
204
  ## Project documentation
231
205
 
232
206
  - [Usage guide](docs/USAGE.md) for CLI commands, configuration, and report formats.
207
+ - [Technical guide](docs/EXPLAINER.md) for architecture and scoring.
233
208
  - [Project context](docs/PROJECT_CONTEXT.md) for the codebase and build map.
234
209
  - [Release runbook](docs/RELEASING.md) for preparing releases and verifying Windows, Ubuntu, and macOS builds.
235
210