@flakiness/vitest 1.11.0 → 1.12.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 +3 -3
- package/lib/reporter.js +7 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -152,7 +152,7 @@ Flakiness.io considers two tests to be *duplicates* when they:
|
|
|
152
152
|
2. Have the same test name
|
|
153
153
|
3. And run in the same Vitest project
|
|
154
154
|
|
|
155
|
-
Flakiness.io relies on full test names to construct test history, so each test must have a unique full name. When Vitest reporter detects tests with identical full names, it issues
|
|
155
|
+
Flakiness.io relies on full test names to construct test history, so each test must have a unique full name. When Vitest reporter detects tests with identical full names, it issues a warning and handles them according to the [`duplicates`](#duplicates-fail--rename) option.
|
|
156
156
|
|
|
157
157
|
### Environment Detection
|
|
158
158
|
|
|
@@ -263,8 +263,8 @@ Controls how the reporter handles tests with duplicate full names. Defaults to `
|
|
|
263
263
|
> [!WARNING]
|
|
264
264
|
> The `'rename'` mode is **not recommended** for regular use. There is no guarantee that test histories will remain stable for duplicate tests, since the renaming is based on internal Vitest identifiers that may change between runs. This mode exists to help evaluate the reporter against large Vitest projects that have not yet resolved their duplicate test names.
|
|
265
265
|
|
|
266
|
-
- **`'fail'`** (default): Duplicate tests are marked as failed with a descriptive error message and a `dupe` annotation. The first duplicate gets a single failed attempt explaining the problem; the remaining duplicates are stripped of their attempts (effectively hidden from the report). This is the recommended mode — it surfaces the problem so you can fix it by renaming your tests.
|
|
267
|
-
- **`'rename'`**: Duplicate tests are automatically renamed by appending a suffix (e.g., ` – dupe #2`, ` – dupe #3`) to their titles. Each renamed test also receives a `dupe` annotation on all its attempts. The first test with a given name keeps its original title; only the subsequent duplicates are renamed.
|
|
266
|
+
- **`'fail'`** (default): Duplicate tests are marked as failed with a descriptive error message and a `dupe` annotation. The first duplicate gets a single failed attempt explaining the problem; the remaining duplicates are stripped of their attempts (effectively hidden from the report). This is the recommended mode — it surfaces the problem so you can fix it by renaming your tests. The console warning lists every duplicate name.
|
|
267
|
+
- **`'rename'`**: Duplicate tests are automatically renamed by appending a suffix (e.g., ` – dupe #2`, ` – dupe #3`) to their titles. Each renamed test also receives a `dupe` annotation on all its attempts. The first test with a given name keeps its original title; only the subsequent duplicates are renamed. The console warning is a single line with the number of renamed tests, e.g. `[flakiness.io] ⚠ Renamed 2 tests with duplicate names (duplicates: 'rename').`
|
|
268
268
|
|
|
269
269
|
```typescript
|
|
270
270
|
reporters: [
|
package/lib/reporter.js
CHANGED
|
@@ -22118,7 +22118,7 @@ import * as nodeUtil from "node:util";
|
|
|
22118
22118
|
// package.json
|
|
22119
22119
|
var package_default = {
|
|
22120
22120
|
name: "@flakiness/vitest",
|
|
22121
|
-
version: "1.
|
|
22121
|
+
version: "1.12.0",
|
|
22122
22122
|
packageManager: "pnpm@11.5.0",
|
|
22123
22123
|
description: "",
|
|
22124
22124
|
main: "lib/reporter.js",
|
|
@@ -22450,7 +22450,8 @@ var ReporterImpl = class _ReporterImpl {
|
|
|
22450
22450
|
}
|
|
22451
22451
|
}
|
|
22452
22452
|
_renameDuplicates(duplicates, testIdToTests) {
|
|
22453
|
-
|
|
22453
|
+
const renamedFullNames = /* @__PURE__ */ new Set();
|
|
22454
|
+
for (const { tests, testId, fullName } of duplicates) {
|
|
22454
22455
|
tests.sort((test1, test2) => {
|
|
22455
22456
|
const id1 = gTestToTestCaseId.get(test1) ?? "";
|
|
22456
22457
|
const id2 = gTestToTestCaseId.get(test2) ?? "";
|
|
@@ -22466,8 +22467,11 @@ var ReporterImpl = class _ReporterImpl {
|
|
|
22466
22467
|
attempt.annotations.push({ type: "dupe" });
|
|
22467
22468
|
});
|
|
22468
22469
|
testIdToTests.set(testId + dupeSuffix(dupeIndex), [tests[i]]);
|
|
22470
|
+
renamedFullNames.add(fullName + dupeSuffix(dupeIndex));
|
|
22469
22471
|
}
|
|
22470
22472
|
}
|
|
22473
|
+
const count = renamedFullNames.size;
|
|
22474
|
+
this._logger.warn(`[flakiness.io] \u26A0 Renamed ${count} ${count === 1 ? "test" : "tests"} with duplicate names (duplicates: 'rename').`);
|
|
22471
22475
|
}
|
|
22472
22476
|
_detectDuplicates(fileSuites) {
|
|
22473
22477
|
const TITLE_SEPARATOR = crypto2.randomBytes(128).toString("base64");
|
|
@@ -22523,10 +22527,10 @@ var ReporterImpl = class _ReporterImpl {
|
|
|
22523
22527
|
this._ramUtilization.sample();
|
|
22524
22528
|
const { duplicates, testIdToTests } = this._detectDuplicates(fileSuites);
|
|
22525
22529
|
if (duplicates.length) {
|
|
22526
|
-
this._warnDuplicates(duplicates);
|
|
22527
22530
|
if (this._options.duplicates === "rename") {
|
|
22528
22531
|
this._renameDuplicates(duplicates, testIdToTests);
|
|
22529
22532
|
} else {
|
|
22533
|
+
this._warnDuplicates(duplicates);
|
|
22530
22534
|
this._failDuplicates(duplicates);
|
|
22531
22535
|
}
|
|
22532
22536
|
}
|
|
@@ -22602,4 +22606,3 @@ function extension(attachment) {
|
|
|
22602
22606
|
export {
|
|
22603
22607
|
FKVitestReporter as default
|
|
22604
22608
|
};
|
|
22605
|
-
//# sourceMappingURL=reporter.js.map
|