@flakiness/vitest 1.10.0 → 1.11.0
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.
- package/README.md +16 -1
- package/lib/reporter.js +7456 -2252
- package/package.json +12 -11
- package/types/src/reporter.d.ts +1 -0
package/README.md
CHANGED
|
@@ -19,6 +19,7 @@ A custom Vitest reporter that generates Flakiness Reports from your Vitest test
|
|
|
19
19
|
- [CI Integration](#ci-integration)
|
|
20
20
|
- [Configuration Options](#configuration-options)
|
|
21
21
|
- [`title?: string`](#title-string)
|
|
22
|
+
- [`commitId?: string`](#commitid-string)
|
|
22
23
|
- [`flakinessProject?: string`](#flakinessproject-string)
|
|
23
24
|
- [`endpoint?: string`](#endpoint-string)
|
|
24
25
|
- [`token?: string`](#token-string)
|
|
@@ -191,7 +192,7 @@ The reporter accepts the following options:
|
|
|
191
192
|
|
|
192
193
|
### `title?: string`
|
|
193
194
|
|
|
194
|
-
Optional human-readable report title. Typically used to name a CI run, matrix shard, or other execution group. Defaults to the `FLAKINESS_TITLE` environment variable
|
|
195
|
+
Optional human-readable report title. Typically used to name a CI run, matrix shard, or other execution group. Defaults to the `FLAKINESS_TITLE` environment variable if set; otherwise a run with `--shard=N/M` is titled `Shard N/M`, and an unsharded run has no title.
|
|
195
196
|
|
|
196
197
|
```typescript
|
|
197
198
|
reporters: [
|
|
@@ -199,6 +200,18 @@ reporters: [
|
|
|
199
200
|
]
|
|
200
201
|
```
|
|
201
202
|
|
|
203
|
+
### `commitId?: string`
|
|
204
|
+
|
|
205
|
+
Full SHA of the commit the report belongs to. Defaults to the `FLAKINESS_COMMIT_ID` environment variable, or the current git commit (`git rev-parse HEAD`) otherwise.
|
|
206
|
+
|
|
207
|
+
Set it when the checked-out commit is not the one under test, for example when a CI job makes a local commit before running the tests.
|
|
208
|
+
|
|
209
|
+
```typescript
|
|
210
|
+
reporters: [
|
|
211
|
+
['@flakiness/vitest', { commitId: process.env.GITHUB_SHA }]
|
|
212
|
+
]
|
|
213
|
+
```
|
|
214
|
+
|
|
202
215
|
### `flakinessProject?: string`
|
|
203
216
|
|
|
204
217
|
The Flakiness.io project identifier in `org/project` format. Required for CI OIDC authentication. When set, and when the Flakiness.io project is bound to the repository running the pipeline, the reporter authenticates uploads via a GitHub Actions or GitLab CI/CD OIDC token with no access token required. See [Uploading Reports](#uploading-reports) for the per-provider requirements.
|
|
@@ -275,6 +288,7 @@ reporters: [
|
|
|
275
288
|
The reporter respects the following environment variables:
|
|
276
289
|
|
|
277
290
|
- **`FLAKINESS_TITLE`**: Human-readable report title (equivalent to `title` option)
|
|
291
|
+
- **`FLAKINESS_COMMIT_ID`**: Commit the report belongs to; defaults to the current git commit (equivalent to `commitId` option)
|
|
278
292
|
- **`FLAKINESS_ACCESS_TOKEN`**: Access token for Flakiness.io uploads (equivalent to `token` option)
|
|
279
293
|
- **`FLAKINESS_ENDPOINT`**: Custom Flakiness.io endpoint URL (equivalent to `endpoint` option)
|
|
280
294
|
- **`FLAKINESS_OUTPUT_DIR`**: Output directory for reports (equivalent to `outputFolder` option)
|
|
@@ -295,6 +309,7 @@ export default defineConfig({
|
|
|
295
309
|
'default',
|
|
296
310
|
['@flakiness/vitest', {
|
|
297
311
|
title: 'My Test Run',
|
|
312
|
+
commitId: process.env.FLAKINESS_COMMIT_ID,
|
|
298
313
|
flakinessProject: 'my-org/my-project',
|
|
299
314
|
endpoint: process.env.FLAKINESS_ENDPOINT,
|
|
300
315
|
token: process.env.FLAKINESS_ACCESS_TOKEN,
|