From 111521e9ed4a50d862c9f6f484fe95098fa90429 Mon Sep 17 00:00:00 2001 From: Matthew Thomas <25988124+Ma11hewThomas@users.noreply.github.com> Date: Sat, 3 Oct 2026 12:54:31 +0100 Subject: [PATCH] Add versioned CTRF schema validation --- README.md | 19 +- docs/classes/ReportBuilder.md | 2 +- docs/functions/getCurrentSpecVersion.md | 2 +- docs/functions/getSchema.md | 10 +- docs/functions/getSupportedSpecVersions.md | 2 +- docs/functions/hasInsights.md | 2 +- docs/functions/isAttemptHistoryEntry.md | 2 +- docs/functions/isCTRFReport.md | 2 +- docs/functions/isRetryAttempt.md | 2 +- docs/functions/isTest.md | 2 +- docs/functions/isTestStatus.md | 2 +- docs/functions/isValid.md | 10 +- docs/functions/validate.md | 6 +- docs/functions/validateStrict.md | 10 +- docs/globals.md | 2 + docs/interfaces/Attachment.md | 12 +- docs/interfaces/AttemptHistoryEntry.md | 30 +- docs/interfaces/Baseline.md | 18 +- docs/interfaces/CTRFReport.md | 22 +- docs/interfaces/Environment.md | 38 +- docs/interfaces/FilterCriteria.md | 22 +- docs/interfaces/Insights.md | 18 +- docs/interfaces/InsightsOptions.md | 6 +- docs/interfaces/MergeOptions.md | 8 +- docs/interfaces/MetricDelta.md | 8 +- docs/interfaces/ParseOptions.md | 4 +- docs/interfaces/ReportBuilderOptions.md | 6 +- docs/interfaces/Results.md | 12 +- docs/interfaces/Step.md | 8 +- docs/interfaces/StringifyOptions.md | 6 +- docs/interfaces/Summary.md | 26 +- docs/interfaces/SummaryOptions.md | 6 +- docs/interfaces/Test.md | 68 +- docs/interfaces/TestBuilderOptions.md | 4 +- docs/interfaces/TestInsights.md | 16 +- docs/interfaces/Tool.md | 8 +- docs/interfaces/ValidateOptions.md | 8 +- docs/interfaces/ValidationErrorDetail.md | 8 +- docs/interfaces/ValidationResult.md | 6 +- docs/type-aliases/LabelPrimitive.md | 2 +- docs/type-aliases/LabelValue.md | 2 +- docs/type-aliases/RetryAttempt.md | 2 +- docs/type-aliases/SchemaSelector.md | 13 + docs/type-aliases/SupportedSpecVersion.md | 13 + docs/type-aliases/TestStatus.md | 2 +- docs/variables/CTRF_NAMESPACE.md | 2 +- docs/variables/CURRENT_SPEC_VERSION.md | 2 +- docs/variables/SUPPORTED_SPEC_VERSIONS.md | 2 +- docs/variables/schema.md | 2 +- package-lock.json | 4 +- package.json | 2 +- src/README.md | 13 +- src/builder.ts | 2 +- src/constants.test.ts | 14 + src/constants.ts | 16 +- src/ctrf-schema-0.0.1.json | 638 ++++++++++++++++ src/ctrf-schema-0.0.2.json | 645 ++++++++++++++++ src/ctrf-schema-0.0.3.json | 710 +++++++++++++++++ ...schema-0.0.json => ctrf-schema-0.0.4.json} | 0 src/ctrf-schema-0.1.0.json | 713 ++++++++++++++++++ src/index.ts | 2 + src/schema.test.ts | 20 +- src/schema.ts | 57 +- src/types.ts | 6 +- src/validate.test.ts | 140 +++- src/validate.ts | 50 +- 66 files changed, 3239 insertions(+), 278 deletions(-) create mode 100644 docs/type-aliases/SchemaSelector.md create mode 100644 docs/type-aliases/SupportedSpecVersion.md create mode 100644 src/ctrf-schema-0.0.1.json create mode 100644 src/ctrf-schema-0.0.2.json create mode 100644 src/ctrf-schema-0.0.3.json rename src/{ctrf-schema-0.0.json => ctrf-schema-0.0.4.json} (100%) create mode 100644 src/ctrf-schema-0.1.0.json diff --git a/README.md b/README.md index 5a9178e..d0303d7 100644 --- a/README.md +++ b/README.md @@ -83,6 +83,12 @@ if (!result.valid) { result.errors?.forEach(err => console.error(err.message)) } +// Validate against a published historical schema +const historicalResult = validate(report, { specVersion: '0.0.2' }) + +// `latest` is an alias for the current published specification +validateStrict(report, { specVersion: 'latest' }) + // Strict validation (throws on invalid) try { validateStrict(report) @@ -247,8 +253,8 @@ import { } from 'ctrf' REPORT_FORMAT // 'CTRF' -CURRENT_SPEC_VERSION // '0.0.0' -SUPPORTED_SPEC_VERSIONS // ['0.0.0'] +CURRENT_SPEC_VERSION // '0.1.0' +SUPPORTED_SPEC_VERSIONS // ['0.0.1', '0.0.2', '0.0.3', '0.0.4', '0.1.0'] TEST_STATUSES // ['passed', 'failed', 'skipped', 'pending', 'other'] CTRF_NAMESPACE // UUID namespace for deterministic IDs ``` @@ -283,10 +289,11 @@ import { schema, getSchema, getCurrentSpecVersion, getSupportedSpecVersions } fr // Get the current JSON Schema console.log(schema) -// Get schema for specific version -const v0_0Schema = getSchema('0.0.0') +// Get schemas for a specific version or the latest published specification +const v0_0_2Schema = getSchema('0.0.2') +const latestSchema = getSchema('latest') // Get version info -const version = getCurrentSpecVersion() // '0.0.0' -const supported = getSupportedSpecVersions() // ['0.0.0'] +const version = getCurrentSpecVersion() // '0.1.0' +const supported = getSupportedSpecVersions() // ['0.0.1', '0.0.2', '0.0.3', '0.0.4', '0.1.0'] ``` diff --git a/docs/classes/ReportBuilder.md b/docs/classes/ReportBuilder.md index 2eea2af..d4277d0 100644 --- a/docs/classes/ReportBuilder.md +++ b/docs/classes/ReportBuilder.md @@ -12,7 +12,7 @@ Defined in: [builder.ts:50](https://github.com/ctrf-io/ctrf-js/blob/main/src/bui ```typescript const report = new ReportBuilder() - .specVersion('1.0.0') + .specVersion('0.1.0') .tool({ name: 'jest', version: '29.0.0' }) .environment({ branchName: 'main' }) .addTest( diff --git a/docs/functions/getCurrentSpecVersion.md b/docs/functions/getCurrentSpecVersion.md index 629371b..068914e 100644 --- a/docs/functions/getCurrentSpecVersion.md +++ b/docs/functions/getCurrentSpecVersion.md @@ -8,7 +8,7 @@ > **getCurrentSpecVersion**(): `string` -Defined in: [schema.ts:88](https://github.com/ctrf-io/ctrf-js/blob/main/src/schema.ts#L88) +Defined in: [schema.ts:93](https://github.com/ctrf-io/ctrf-js/blob/main/src/schema.ts#L93) ## Returns diff --git a/docs/functions/getSchema.md b/docs/functions/getSchema.md index ca41f21..ac33bfe 100644 --- a/docs/functions/getSchema.md +++ b/docs/functions/getSchema.md @@ -8,15 +8,15 @@ > **getSchema**(`version`): `object` -Defined in: [schema.ts:69](https://github.com/ctrf-io/ctrf-js/blob/main/src/schema.ts#L69) +Defined in: [schema.ts:82](https://github.com/ctrf-io/ctrf-js/blob/main/src/schema.ts#L82) ## Parameters ### version -`string` +[`SchemaSelector`](../type-aliases/SchemaSelector.md) -The spec version (MAJOR.MINOR.PATCH) to get the schema for +A supported spec version or `latest` ## Returns @@ -31,6 +31,6 @@ SchemaVersionError if the version is not supported ## Example ```typescript -const v0_0Schema = getSchema('0.0.0'); -const v1_0Schema = getSchema('1.0.0'); +const historicalSchema = getSchema('0.0.2'); +const latestSchema = getSchema('latest'); ``` diff --git a/docs/functions/getSupportedSpecVersions.md b/docs/functions/getSupportedSpecVersions.md index cb4c4cd..9bfe444 100644 --- a/docs/functions/getSupportedSpecVersions.md +++ b/docs/functions/getSupportedSpecVersions.md @@ -8,7 +8,7 @@ > **getSupportedSpecVersions**(): readonly `string`[] -Defined in: [schema.ts:99](https://github.com/ctrf-io/ctrf-js/blob/main/src/schema.ts#L99) +Defined in: [schema.ts:104](https://github.com/ctrf-io/ctrf-js/blob/main/src/schema.ts#L104) ## Returns diff --git a/docs/functions/hasInsights.md b/docs/functions/hasInsights.md index 07d80b1..98b3ee8 100644 --- a/docs/functions/hasInsights.md +++ b/docs/functions/hasInsights.md @@ -8,7 +8,7 @@ > **hasInsights**(`report`): `boolean` -Defined in: [validate.ts:285](https://github.com/ctrf-io/ctrf-js/blob/main/src/validate.ts#L285) +Defined in: [validate.ts:315](https://github.com/ctrf-io/ctrf-js/blob/main/src/validate.ts#L315) ## Parameters diff --git a/docs/functions/isAttemptHistoryEntry.md b/docs/functions/isAttemptHistoryEntry.md index 6dd5a90..6382c3b 100644 --- a/docs/functions/isAttemptHistoryEntry.md +++ b/docs/functions/isAttemptHistoryEntry.md @@ -8,7 +8,7 @@ > **isAttemptHistoryEntry**(`obj`): `obj is AttemptHistoryEntry` -Defined in: [validate.ts:255](https://github.com/ctrf-io/ctrf-js/blob/main/src/validate.ts#L255) +Defined in: [validate.ts:285](https://github.com/ctrf-io/ctrf-js/blob/main/src/validate.ts#L285) ## Parameters diff --git a/docs/functions/isCTRFReport.md b/docs/functions/isCTRFReport.md index f0d3b99..995d950 100644 --- a/docs/functions/isCTRFReport.md +++ b/docs/functions/isCTRFReport.md @@ -8,7 +8,7 @@ > **isCTRFReport**(`report`): `report is { reportFormat: "CTRF" }` -Defined in: [validate.ts:196](https://github.com/ctrf-io/ctrf-js/blob/main/src/validate.ts#L196) +Defined in: [validate.ts:226](https://github.com/ctrf-io/ctrf-js/blob/main/src/validate.ts#L226) ## Parameters diff --git a/docs/functions/isRetryAttempt.md b/docs/functions/isRetryAttempt.md index 60d3b78..96b0dee 100644 --- a/docs/functions/isRetryAttempt.md +++ b/docs/functions/isRetryAttempt.md @@ -8,7 +8,7 @@ > **isRetryAttempt**(`obj`): `obj is AttemptHistoryEntry` -Defined in: [validate.ts:273](https://github.com/ctrf-io/ctrf-js/blob/main/src/validate.ts#L273) +Defined in: [validate.ts:303](https://github.com/ctrf-io/ctrf-js/blob/main/src/validate.ts#L303) Backward-compatible alias for [isAttemptHistoryEntry](isAttemptHistoryEntry.md). diff --git a/docs/functions/isTest.md b/docs/functions/isTest.md index 0b45363..34785a3 100644 --- a/docs/functions/isTest.md +++ b/docs/functions/isTest.md @@ -8,7 +8,7 @@ > **isTest**(`obj`): `obj is { name: string; status: string; duration: number }` -Defined in: [validate.ts:215](https://github.com/ctrf-io/ctrf-js/blob/main/src/validate.ts#L215) +Defined in: [validate.ts:245](https://github.com/ctrf-io/ctrf-js/blob/main/src/validate.ts#L245) ## Parameters diff --git a/docs/functions/isTestStatus.md b/docs/functions/isTestStatus.md index 8dfa7bb..4af21ca 100644 --- a/docs/functions/isTestStatus.md +++ b/docs/functions/isTestStatus.md @@ -8,7 +8,7 @@ > **isTestStatus**(`value`): value is "skipped" \| "failed" \| "other" \| "pending" \| "passed" -Defined in: [validate.ts:238](https://github.com/ctrf-io/ctrf-js/blob/main/src/validate.ts#L238) +Defined in: [validate.ts:268](https://github.com/ctrf-io/ctrf-js/blob/main/src/validate.ts#L268) ## Parameters diff --git a/docs/functions/isValid.md b/docs/functions/isValid.md index 0b324b2..ed0b329 100644 --- a/docs/functions/isValid.md +++ b/docs/functions/isValid.md @@ -6,9 +6,9 @@ # Function: isValid() -> **isValid**(`report`): `report is CTRFReport` +> **isValid**(`report`, `options?`): `report is CTRFReport` -Defined in: [validate.ts:141](https://github.com/ctrf-io/ctrf-js/blob/main/src/validate.ts#L141) +Defined in: [validate.ts:164](https://github.com/ctrf-io/ctrf-js/blob/main/src/validate.ts#L164) ## Parameters @@ -18,6 +18,12 @@ Defined in: [validate.ts:141](https://github.com/ctrf-io/ctrf-js/blob/main/src/v The object to validate +### options? + +[`ValidateOptions`](../interfaces/ValidateOptions.md) = `{}` + +Validation options (e.g., a specific spec version or `latest`) + ## Returns `report is CTRFReport` diff --git a/docs/functions/validate.md b/docs/functions/validate.md index e6ea647..505c54e 100644 --- a/docs/functions/validate.md +++ b/docs/functions/validate.md @@ -8,7 +8,7 @@ > **validate**(`report`, `options?`): [`ValidationResult`](../interfaces/ValidationResult.md) -Defined in: [validate.ts:97](https://github.com/ctrf-io/ctrf-js/blob/main/src/validate.ts#L97) +Defined in: [validate.ts:110](https://github.com/ctrf-io/ctrf-js/blob/main/src/validate.ts#L110) Validate a CTRF report against the JSON schema and normative cross-field rules that JSON Schema cannot express. @@ -25,7 +25,7 @@ The object to validate [`ValidateOptions`](../interfaces/ValidateOptions.md) = `{}` -Validation options (e.g., specific spec version) +Validation options (e.g., a specific spec version or `latest`) ## Returns @@ -42,5 +42,5 @@ if (!result.valid) { } // Validate against specific version -const result = validate(report, { specVersion: '1.0.0' }); +const result = validate(report, { specVersion: '0.0.2' }); ``` diff --git a/docs/functions/validateStrict.md b/docs/functions/validateStrict.md index c6c451b..f68d7c8 100644 --- a/docs/functions/validateStrict.md +++ b/docs/functions/validateStrict.md @@ -6,9 +6,9 @@ # Function: validateStrict() -> **validateStrict**(`report`): `asserts report is CTRFReport` +> **validateStrict**(`report`, `options?`): `asserts report is CTRFReport` -Defined in: [validate.ts:166](https://github.com/ctrf-io/ctrf-js/blob/main/src/validate.ts#L166) +Defined in: [validate.ts:193](https://github.com/ctrf-io/ctrf-js/blob/main/src/validate.ts#L193) ## Parameters @@ -18,6 +18,12 @@ Defined in: [validate.ts:166](https://github.com/ctrf-io/ctrf-js/blob/main/src/v The object to validate +### options? + +[`ValidateOptions`](../interfaces/ValidateOptions.md) = `{}` + +Validation options (e.g., a specific spec version or `latest`) + ## Returns `asserts report is CTRFReport` diff --git a/docs/globals.md b/docs/globals.md index 44fff81..5abb581 100644 --- a/docs/globals.md +++ b/docs/globals.md @@ -200,6 +200,8 @@ The current version CTRF JSON Schema object. ## Type Aliases +- [SupportedSpecVersion](type-aliases/SupportedSpecVersion.md) +- [SchemaSelector](type-aliases/SchemaSelector.md) - [LabelPrimitive](type-aliases/LabelPrimitive.md) - [LabelValue](type-aliases/LabelValue.md) diff --git a/docs/interfaces/Attachment.md b/docs/interfaces/Attachment.md index 99f5fa5..6a056f9 100644 --- a/docs/interfaces/Attachment.md +++ b/docs/interfaces/Attachment.md @@ -6,7 +6,7 @@ # Interface: Attachment -Defined in: [types.ts:242](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L242) +Defined in: [types.ts:244](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L244) File attachment @@ -16,7 +16,7 @@ File attachment > `optional` **attachmentId?**: `string` -Defined in: [types.ts:244](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L244) +Defined in: [types.ts:246](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L246) Identifier for this attachment reference instance @@ -26,7 +26,7 @@ Identifier for this attachment reference instance > **name**: `string` -Defined in: [types.ts:246](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L246) +Defined in: [types.ts:248](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L248) Attachment name @@ -36,7 +36,7 @@ Attachment name > **contentType**: `string` -Defined in: [types.ts:248](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L248) +Defined in: [types.ts:250](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L250) MIME content type @@ -46,7 +46,7 @@ MIME content type > **path**: `string` -Defined in: [types.ts:250](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L250) +Defined in: [types.ts:252](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L252) Path to the attachment file @@ -56,6 +56,6 @@ Path to the attachment file > `optional` **extra?**: `Record`\<`string`, `unknown`\> -Defined in: [types.ts:252](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L252) +Defined in: [types.ts:254](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L254) Custom metadata diff --git a/docs/interfaces/AttemptHistoryEntry.md b/docs/interfaces/AttemptHistoryEntry.md index c9da506..8aea5d2 100644 --- a/docs/interfaces/AttemptHistoryEntry.md +++ b/docs/interfaces/AttemptHistoryEntry.md @@ -6,7 +6,7 @@ # Interface: AttemptHistoryEntry -Defined in: [types.ts:196](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L196) +Defined in: [types.ts:198](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L198) An attempt completed before the final attempt represented by the test object. Despite the `retryAttempts` field name, the history includes the initial @@ -18,7 +18,7 @@ attempt when a retry occurred and excludes the final attempt. > **attempt**: `number` -Defined in: [types.ts:198](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L198) +Defined in: [types.ts:200](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L200) Original sequence number for this attempt (1 = initial execution) @@ -28,7 +28,7 @@ Original sequence number for this attempt (1 = initial execution) > `optional` **attemptId?**: `string` -Defined in: [types.ts:200](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L200) +Defined in: [types.ts:202](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L202) Identifier for this individual attempt @@ -38,7 +38,7 @@ Identifier for this individual attempt > **status**: [`TestStatus`](../type-aliases/TestStatus.md) -Defined in: [types.ts:202](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L202) +Defined in: [types.ts:204](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L204) Status of this attempt @@ -48,7 +48,7 @@ Status of this attempt > `optional` **duration?**: `number` -Defined in: [types.ts:204](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L204) +Defined in: [types.ts:206](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L206) Duration of this attempt in milliseconds @@ -58,7 +58,7 @@ Duration of this attempt in milliseconds > `optional` **message?**: `string` -Defined in: [types.ts:206](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L206) +Defined in: [types.ts:208](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L208) Error message @@ -68,7 +68,7 @@ Error message > `optional` **trace?**: `string` -Defined in: [types.ts:208](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L208) +Defined in: [types.ts:210](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L210) Stack trace @@ -78,7 +78,7 @@ Stack trace > `optional` **line?**: `number` -Defined in: [types.ts:210](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L210) +Defined in: [types.ts:212](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L212) Line number @@ -88,7 +88,7 @@ Line number > `optional` **snippet?**: `string` -Defined in: [types.ts:212](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L212) +Defined in: [types.ts:214](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L214) Code snippet @@ -98,7 +98,7 @@ Code snippet > `optional` **stdout?**: `string`[] -Defined in: [types.ts:214](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L214) +Defined in: [types.ts:216](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L216) Standard output @@ -108,7 +108,7 @@ Standard output > `optional` **stderr?**: `string`[] -Defined in: [types.ts:216](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L216) +Defined in: [types.ts:218](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L218) Standard error @@ -118,7 +118,7 @@ Standard error > `optional` **start?**: `number` -Defined in: [types.ts:218](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L218) +Defined in: [types.ts:220](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L220) Start timestamp @@ -128,7 +128,7 @@ Start timestamp > `optional` **stop?**: `number` -Defined in: [types.ts:220](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L220) +Defined in: [types.ts:222](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L222) Stop timestamp @@ -138,7 +138,7 @@ Stop timestamp > `optional` **attachments?**: [`Attachment`](Attachment.md)[] -Defined in: [types.ts:222](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L222) +Defined in: [types.ts:224](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L224) Attachments for this attempt @@ -148,6 +148,6 @@ Attachments for this attempt > `optional` **extra?**: `Record`\<`string`, `unknown`\> -Defined in: [types.ts:224](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L224) +Defined in: [types.ts:226](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L226) Custom metadata diff --git a/docs/interfaces/Baseline.md b/docs/interfaces/Baseline.md index 1e126a5..8ff4081 100644 --- a/docs/interfaces/Baseline.md +++ b/docs/interfaces/Baseline.md @@ -6,7 +6,7 @@ # Interface: Baseline -Defined in: [types.ts:382](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L382) +Defined in: [types.ts:384](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L384) Reference to a baseline report @@ -16,7 +16,7 @@ Reference to a baseline report > **reportId**: `string` -Defined in: [types.ts:384](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L384) +Defined in: [types.ts:386](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L386) Report ID of the baseline report @@ -26,7 +26,7 @@ Report ID of the baseline report > `optional` **timestamp?**: `string` -Defined in: [types.ts:386](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L386) +Defined in: [types.ts:388](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L388) Timestamp of the baseline report @@ -36,7 +36,7 @@ Timestamp of the baseline report > `optional` **source?**: `string` -Defined in: [types.ts:388](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L388) +Defined in: [types.ts:390](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L390) Source description (e.g., 'main-branch', 'previous-run') @@ -46,7 +46,7 @@ Source description (e.g., 'main-branch', 'previous-run') > `optional` **buildNumber?**: `number` -Defined in: [types.ts:390](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L390) +Defined in: [types.ts:392](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L392) Build number of the baseline @@ -56,7 +56,7 @@ Build number of the baseline > `optional` **buildName?**: `string` -Defined in: [types.ts:392](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L392) +Defined in: [types.ts:394](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L394) Build name of the baseline @@ -66,7 +66,7 @@ Build name of the baseline > `optional` **buildUrl?**: `string` -Defined in: [types.ts:394](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L394) +Defined in: [types.ts:396](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L396) Build URL of the baseline @@ -76,7 +76,7 @@ Build URL of the baseline > `optional` **commit?**: `string` -Defined in: [types.ts:396](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L396) +Defined in: [types.ts:398](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L398) Git commit of the baseline @@ -86,6 +86,6 @@ Git commit of the baseline > `optional` **extra?**: `Record`\<`string`, `unknown`\> -Defined in: [types.ts:398](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L398) +Defined in: [types.ts:400](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L400) Custom metadata diff --git a/docs/interfaces/CTRFReport.md b/docs/interfaces/CTRFReport.md index bf46c36..923f481 100644 --- a/docs/interfaces/CTRFReport.md +++ b/docs/interfaces/CTRFReport.md @@ -6,7 +6,7 @@ # Interface: CTRFReport -Defined in: [types.ts:15](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L15) +Defined in: [types.ts:17](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L17) The root CTRF report object @@ -16,7 +16,7 @@ The root CTRF report object > **reportFormat**: `"CTRF"` -Defined in: [types.ts:17](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L17) +Defined in: [types.ts:19](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L19) Must be 'CTRF' @@ -26,7 +26,7 @@ Must be 'CTRF' > **specVersion**: `string` -Defined in: [types.ts:19](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L19) +Defined in: [types.ts:21](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L21) Semantic version of the CTRF specification @@ -36,7 +36,7 @@ Semantic version of the CTRF specification > `optional` **reportId?**: `string` -Defined in: [types.ts:21](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L21) +Defined in: [types.ts:23](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L23) Unique identifier for this report (UUID v4) @@ -46,7 +46,7 @@ Unique identifier for this report (UUID v4) > `optional` **runId?**: `string` -Defined in: [types.ts:23](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L23) +Defined in: [types.ts:25](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L25) Identifier shared by all documents belonging to the same logical test run @@ -56,7 +56,7 @@ Identifier shared by all documents belonging to the same logical test run > `optional` **timestamp?**: `string` -Defined in: [types.ts:25](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L25) +Defined in: [types.ts:27](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L27) ISO 8601 timestamp when the report was generated @@ -66,7 +66,7 @@ ISO 8601 timestamp when the report was generated > `optional` **generatedBy?**: `string` -Defined in: [types.ts:27](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L27) +Defined in: [types.ts:29](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L29) Name of the tool/library that generated this report @@ -76,7 +76,7 @@ Name of the tool/library that generated this report > **results**: [`Results`](Results.md) -Defined in: [types.ts:29](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L29) +Defined in: [types.ts:31](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L31) The test results @@ -86,7 +86,7 @@ The test results > `optional` **insights?**: [`Insights`](Insights.md) -Defined in: [types.ts:31](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L31) +Defined in: [types.ts:33](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L33) Run-level insights computed from historical data @@ -96,7 +96,7 @@ Run-level insights computed from historical data > `optional` **baseline?**: [`Baseline`](Baseline.md) -Defined in: [types.ts:33](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L33) +Defined in: [types.ts:35](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L35) Reference to a baseline report for comparison @@ -106,6 +106,6 @@ Reference to a baseline report for comparison > `optional` **extra?**: `Record`\<`string`, `unknown`\> -Defined in: [types.ts:35](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L35) +Defined in: [types.ts:37](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L37) Custom metadata diff --git a/docs/interfaces/Environment.md b/docs/interfaces/Environment.md index 57da770..3491374 100644 --- a/docs/interfaces/Environment.md +++ b/docs/interfaces/Environment.md @@ -6,7 +6,7 @@ # Interface: Environment -Defined in: [types.ts:274](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L274) +Defined in: [types.ts:276](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L276) Environment information @@ -16,7 +16,7 @@ Environment information > `optional` **reportName?**: `string` -Defined in: [types.ts:276](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L276) +Defined in: [types.ts:278](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L278) Custom report name @@ -26,7 +26,7 @@ Custom report name > `optional` **appName?**: `string` -Defined in: [types.ts:278](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L278) +Defined in: [types.ts:280](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L280) Application name @@ -36,7 +36,7 @@ Application name > `optional` **appVersion?**: `string` -Defined in: [types.ts:280](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L280) +Defined in: [types.ts:282](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L282) Application version @@ -46,7 +46,7 @@ Application version > `optional` **buildId?**: `string` -Defined in: [types.ts:282](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L282) +Defined in: [types.ts:284](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L284) Build identifier @@ -56,7 +56,7 @@ Build identifier > `optional` **buildName?**: `string` -Defined in: [types.ts:284](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L284) +Defined in: [types.ts:286](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L286) Build name @@ -66,7 +66,7 @@ Build name > `optional` **buildNumber?**: `number` -Defined in: [types.ts:286](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L286) +Defined in: [types.ts:288](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L288) Build number @@ -76,7 +76,7 @@ Build number > `optional` **buildUrl?**: `string` -Defined in: [types.ts:288](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L288) +Defined in: [types.ts:290](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L290) Build URL @@ -86,7 +86,7 @@ Build URL > `optional` **repositoryName?**: `string` -Defined in: [types.ts:290](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L290) +Defined in: [types.ts:292](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L292) Repository name @@ -96,7 +96,7 @@ Repository name > `optional` **repositoryUrl?**: `string` -Defined in: [types.ts:292](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L292) +Defined in: [types.ts:294](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L294) Repository URL @@ -106,7 +106,7 @@ Repository URL > `optional` **commit?**: `string` -Defined in: [types.ts:294](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L294) +Defined in: [types.ts:296](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L296) Git commit SHA @@ -116,7 +116,7 @@ Git commit SHA > `optional` **branchName?**: `string` -Defined in: [types.ts:296](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L296) +Defined in: [types.ts:298](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L298) Git branch name @@ -126,7 +126,7 @@ Git branch name > `optional` **osPlatform?**: `string` -Defined in: [types.ts:298](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L298) +Defined in: [types.ts:300](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L300) Operating system platform @@ -136,7 +136,7 @@ Operating system platform > `optional` **osRelease?**: `string` -Defined in: [types.ts:300](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L300) +Defined in: [types.ts:302](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L302) Operating system release @@ -146,7 +146,7 @@ Operating system release > `optional` **osVersion?**: `string` -Defined in: [types.ts:302](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L302) +Defined in: [types.ts:304](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L304) Operating system version @@ -156,7 +156,7 @@ Operating system version > `optional` **testEnvironment?**: `string` -Defined in: [types.ts:304](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L304) +Defined in: [types.ts:306](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L306) Test environment name @@ -166,7 +166,7 @@ Test environment name > `optional` **shardId?**: `string` -Defined in: [types.ts:306](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L306) +Defined in: [types.ts:308](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L308) Shard or partition that produced this document @@ -176,7 +176,7 @@ Shard or partition that produced this document > `optional` **healthy?**: `boolean` -Defined in: [types.ts:308](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L308) +Defined in: [types.ts:310](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L310) Whether the environment is healthy @@ -186,6 +186,6 @@ Whether the environment is healthy > `optional` **extra?**: `Record`\<`string`, `unknown`\> -Defined in: [types.ts:310](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L310) +Defined in: [types.ts:312](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L312) Custom metadata diff --git a/docs/interfaces/FilterCriteria.md b/docs/interfaces/FilterCriteria.md index f3e8e22..75950dc 100644 --- a/docs/interfaces/FilterCriteria.md +++ b/docs/interfaces/FilterCriteria.md @@ -6,7 +6,7 @@ # Interface: FilterCriteria -Defined in: [types.ts:450](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L450) +Defined in: [types.ts:452](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L452) Criteria for filtering and finding tests. @@ -16,7 +16,7 @@ Criteria for filtering and finding tests. > `optional` **id?**: `string` -Defined in: [types.ts:452](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L452) +Defined in: [types.ts:454](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L454) Filter by legacy test ID (UUID) @@ -26,7 +26,7 @@ Filter by legacy test ID (UUID) > `optional` **testId?**: `string` -Defined in: [types.ts:454](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L454) +Defined in: [types.ts:456](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L456) Filter by stable logical test case ID @@ -36,7 +36,7 @@ Filter by stable logical test case ID > `optional` **executionId?**: `string` -Defined in: [types.ts:456](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L456) +Defined in: [types.ts:458](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L458) Filter by a specific test execution ID @@ -46,7 +46,7 @@ Filter by a specific test execution ID > `optional` **name?**: `string` -Defined in: [types.ts:458](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L458) +Defined in: [types.ts:460](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L460) Filter by test name @@ -56,7 +56,7 @@ Filter by test name > `optional` **status?**: [`TestStatus`](../type-aliases/TestStatus.md) \| [`TestStatus`](../type-aliases/TestStatus.md)[] -Defined in: [types.ts:460](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L460) +Defined in: [types.ts:462](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L462) Filter by status @@ -66,7 +66,7 @@ Filter by status > `optional` **tags?**: `string` \| `string`[] -Defined in: [types.ts:462](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L462) +Defined in: [types.ts:464](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L464) Filter by tags @@ -76,7 +76,7 @@ Filter by tags > `optional` **suite?**: `string` \| `string`[] -Defined in: [types.ts:464](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L464) +Defined in: [types.ts:466](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L466) Filter by suite @@ -86,7 +86,7 @@ Filter by suite > `optional` **flaky?**: `boolean` -Defined in: [types.ts:466](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L466) +Defined in: [types.ts:468](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L468) Filter by flaky flag @@ -96,7 +96,7 @@ Filter by flaky flag > `optional` **browser?**: `string` -Defined in: [types.ts:468](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L468) +Defined in: [types.ts:470](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L470) Filter by browser @@ -106,6 +106,6 @@ Filter by browser > `optional` **device?**: `string` -Defined in: [types.ts:470](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L470) +Defined in: [types.ts:472](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L472) Filter by device diff --git a/docs/interfaces/Insights.md b/docs/interfaces/Insights.md index efa37a4..da6f07e 100644 --- a/docs/interfaces/Insights.md +++ b/docs/interfaces/Insights.md @@ -6,7 +6,7 @@ # Interface: Insights -Defined in: [types.ts:322](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L322) +Defined in: [types.ts:324](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L324) Run-level insights computed from historical data @@ -16,7 +16,7 @@ Run-level insights computed from historical data > `optional` **passRate?**: [`MetricDelta`](MetricDelta.md) -Defined in: [types.ts:324](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L324) +Defined in: [types.ts:326](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L326) Pass rate metric @@ -26,7 +26,7 @@ Pass rate metric > `optional` **failRate?**: [`MetricDelta`](MetricDelta.md) -Defined in: [types.ts:326](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L326) +Defined in: [types.ts:328](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L328) Fail rate metric @@ -36,7 +36,7 @@ Fail rate metric > `optional` **flakyRate?**: [`MetricDelta`](MetricDelta.md) -Defined in: [types.ts:328](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L328) +Defined in: [types.ts:330](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L330) Flaky rate metric @@ -46,7 +46,7 @@ Flaky rate metric > `optional` **averageRunDuration?**: [`MetricDelta`](MetricDelta.md) -Defined in: [types.ts:330](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L330) +Defined in: [types.ts:332](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L332) Average run duration metric @@ -56,7 +56,7 @@ Average run duration metric > `optional` **p95RunDuration?**: [`MetricDelta`](MetricDelta.md) -Defined in: [types.ts:332](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L332) +Defined in: [types.ts:334](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L334) 95th percentile run duration metric @@ -66,7 +66,7 @@ Defined in: [types.ts:332](https://github.com/ctrf-io/ctrf-js/blob/main/src/type > `optional` **averageTestDuration?**: [`MetricDelta`](MetricDelta.md) -Defined in: [types.ts:334](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L334) +Defined in: [types.ts:336](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L336) Average test duration metric @@ -76,7 +76,7 @@ Average test duration metric > `optional` **runsAnalyzed?**: `number` -Defined in: [types.ts:336](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L336) +Defined in: [types.ts:338](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L338) Number of historical runs analyzed @@ -86,6 +86,6 @@ Number of historical runs analyzed > `optional` **extra?**: `Record`\<`string`, `unknown`\> -Defined in: [types.ts:338](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L338) +Defined in: [types.ts:340](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L340) Custom metadata diff --git a/docs/interfaces/InsightsOptions.md b/docs/interfaces/InsightsOptions.md index 4cdbf7d..7e44e13 100644 --- a/docs/interfaces/InsightsOptions.md +++ b/docs/interfaces/InsightsOptions.md @@ -6,7 +6,7 @@ # Interface: InsightsOptions -Defined in: [types.ts:478](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L478) +Defined in: [types.ts:480](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L480) Options for insights calculation @@ -16,7 +16,7 @@ Options for insights calculation > `optional` **baseline?**: [`CTRFReport`](CTRFReport.md) -Defined in: [types.ts:480](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L480) +Defined in: [types.ts:482](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L482) Baseline report for comparison @@ -26,6 +26,6 @@ Baseline report for comparison > `optional` **window?**: `number` -Defined in: [types.ts:482](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L482) +Defined in: [types.ts:484](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L484) Number of historical reports to analyze diff --git a/docs/interfaces/MergeOptions.md b/docs/interfaces/MergeOptions.md index 37e050b..21ce275 100644 --- a/docs/interfaces/MergeOptions.md +++ b/docs/interfaces/MergeOptions.md @@ -6,7 +6,7 @@ # Interface: MergeOptions -Defined in: [types.ts:436](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L436) +Defined in: [types.ts:438](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L438) Options for merging reports @@ -16,7 +16,7 @@ Options for merging reports > `optional` **deduplicateTests?**: `boolean` -Defined in: [types.ts:438](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L438) +Defined in: [types.ts:440](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L440) Remove duplicate tests by executionId, testId, or legacy id @@ -26,7 +26,7 @@ Remove duplicate tests by executionId, testId, or legacy id > `optional` **mergeSummary?**: `boolean` -Defined in: [types.ts:440](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L440) +Defined in: [types.ts:442](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L442) Recalculate summary from merged tests @@ -36,6 +36,6 @@ Recalculate summary from merged tests > `optional` **preserveEnvironment?**: `"first"` \| `"last"` \| `"merge"` -Defined in: [types.ts:442](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L442) +Defined in: [types.ts:444](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L444) Strategy for handling environments diff --git a/docs/interfaces/MetricDelta.md b/docs/interfaces/MetricDelta.md index 013e2ff..c21dc6f 100644 --- a/docs/interfaces/MetricDelta.md +++ b/docs/interfaces/MetricDelta.md @@ -6,7 +6,7 @@ # Interface: MetricDelta -Defined in: [types.ts:368](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L368) +Defined in: [types.ts:370](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L370) Metric with current value, baseline, and change @@ -16,7 +16,7 @@ Metric with current value, baseline, and change > `optional` **current?**: `number` -Defined in: [types.ts:370](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L370) +Defined in: [types.ts:372](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L372) Current value @@ -26,7 +26,7 @@ Current value > `optional` **baseline?**: `number` -Defined in: [types.ts:372](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L372) +Defined in: [types.ts:374](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L374) Baseline value for comparison @@ -36,6 +36,6 @@ Baseline value for comparison > `optional` **change?**: `number` -Defined in: [types.ts:374](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L374) +Defined in: [types.ts:376](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L376) Change from baseline (current - baseline) diff --git a/docs/interfaces/ParseOptions.md b/docs/interfaces/ParseOptions.md index 72787ba..8cc803c 100644 --- a/docs/interfaces/ParseOptions.md +++ b/docs/interfaces/ParseOptions.md @@ -6,7 +6,7 @@ # Interface: ParseOptions -Defined in: [types.ts:524](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L524) +Defined in: [types.ts:526](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L526) Options for parsing JSON @@ -16,6 +16,6 @@ Options for parsing JSON > `optional` **validate?**: `boolean` -Defined in: [types.ts:526](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L526) +Defined in: [types.ts:528](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L528) Validate after parsing diff --git a/docs/interfaces/ReportBuilderOptions.md b/docs/interfaces/ReportBuilderOptions.md index 86acb65..18bbd9a 100644 --- a/docs/interfaces/ReportBuilderOptions.md +++ b/docs/interfaces/ReportBuilderOptions.md @@ -6,7 +6,7 @@ # Interface: ReportBuilderOptions -Defined in: [types.ts:490](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L490) +Defined in: [types.ts:492](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L492) Options for ReportBuilder @@ -16,7 +16,7 @@ Options for ReportBuilder > `optional` **autoGenerateId?**: `boolean` -Defined in: [types.ts:492](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L492) +Defined in: [types.ts:494](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L494) Automatically generate report ID @@ -26,6 +26,6 @@ Automatically generate report ID > `optional` **autoTimestamp?**: `boolean` -Defined in: [types.ts:494](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L494) +Defined in: [types.ts:496](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L496) Automatically set timestamp diff --git a/docs/interfaces/Results.md b/docs/interfaces/Results.md index c1db757..42b011d 100644 --- a/docs/interfaces/Results.md +++ b/docs/interfaces/Results.md @@ -6,7 +6,7 @@ # Interface: Results -Defined in: [types.ts:43](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L43) +Defined in: [types.ts:45](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L45) Container for test results @@ -16,7 +16,7 @@ Container for test results > **tool**: [`Tool`](Tool.md) -Defined in: [types.ts:45](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L45) +Defined in: [types.ts:47](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L47) Information about the test tool @@ -26,7 +26,7 @@ Information about the test tool > **summary**: [`Summary`](Summary.md) -Defined in: [types.ts:47](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L47) +Defined in: [types.ts:49](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L49) Aggregated test statistics @@ -36,7 +36,7 @@ Aggregated test statistics > **tests**: [`Test`](Test.md)[] -Defined in: [types.ts:49](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L49) +Defined in: [types.ts:51](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L51) Array of individual test results @@ -46,7 +46,7 @@ Array of individual test results > `optional` **environment?**: [`Environment`](Environment.md) -Defined in: [types.ts:51](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L51) +Defined in: [types.ts:53](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L53) Environment information @@ -56,6 +56,6 @@ Environment information > `optional` **extra?**: `Record`\<`string`, `unknown`\> -Defined in: [types.ts:53](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L53) +Defined in: [types.ts:55](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L55) Custom metadata diff --git a/docs/interfaces/Step.md b/docs/interfaces/Step.md index 1f33d82..229c62b 100644 --- a/docs/interfaces/Step.md +++ b/docs/interfaces/Step.md @@ -6,7 +6,7 @@ # Interface: Step -Defined in: [types.ts:260](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L260) +Defined in: [types.ts:262](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L262) Test step @@ -16,7 +16,7 @@ Test step > **name**: `string` -Defined in: [types.ts:262](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L262) +Defined in: [types.ts:264](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L264) Step name @@ -26,7 +26,7 @@ Step name > **status**: [`TestStatus`](../type-aliases/TestStatus.md) -Defined in: [types.ts:264](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L264) +Defined in: [types.ts:266](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L266) Step status @@ -36,6 +36,6 @@ Step status > `optional` **extra?**: `Record`\<`string`, `unknown`\> -Defined in: [types.ts:266](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L266) +Defined in: [types.ts:268](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L268) Custom metadata diff --git a/docs/interfaces/StringifyOptions.md b/docs/interfaces/StringifyOptions.md index 84e908b..b81b650 100644 --- a/docs/interfaces/StringifyOptions.md +++ b/docs/interfaces/StringifyOptions.md @@ -6,7 +6,7 @@ # Interface: StringifyOptions -Defined in: [types.ts:534](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L534) +Defined in: [types.ts:536](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L536) Options for stringifying to JSON @@ -16,7 +16,7 @@ Options for stringifying to JSON > `optional` **pretty?**: `boolean` -Defined in: [types.ts:536](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L536) +Defined in: [types.ts:538](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L538) Pretty print with indentation @@ -26,6 +26,6 @@ Pretty print with indentation > `optional` **indent?**: `number` -Defined in: [types.ts:538](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L538) +Defined in: [types.ts:540](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L540) Number of spaces for indentation (default: 2) diff --git a/docs/interfaces/Summary.md b/docs/interfaces/Summary.md index a2c1651..ed4ee12 100644 --- a/docs/interfaces/Summary.md +++ b/docs/interfaces/Summary.md @@ -6,7 +6,7 @@ # Interface: Summary -Defined in: [types.ts:75](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L75) +Defined in: [types.ts:77](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L77) Aggregated test statistics @@ -16,7 +16,7 @@ Aggregated test statistics > **tests**: `number` -Defined in: [types.ts:77](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L77) +Defined in: [types.ts:79](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L79) Total number of tests @@ -26,7 +26,7 @@ Total number of tests > **passed**: `number` -Defined in: [types.ts:79](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L79) +Defined in: [types.ts:81](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L81) Number of passed tests @@ -36,7 +36,7 @@ Number of passed tests > **failed**: `number` -Defined in: [types.ts:81](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L81) +Defined in: [types.ts:83](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L83) Number of failed tests @@ -46,7 +46,7 @@ Number of failed tests > **skipped**: `number` -Defined in: [types.ts:83](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L83) +Defined in: [types.ts:85](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L85) Number of skipped tests @@ -56,7 +56,7 @@ Number of skipped tests > **pending**: `number` -Defined in: [types.ts:85](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L85) +Defined in: [types.ts:87](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L87) Number of pending tests @@ -66,7 +66,7 @@ Number of pending tests > **other**: `number` -Defined in: [types.ts:87](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L87) +Defined in: [types.ts:89](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L89) Number of tests with other status @@ -76,7 +76,7 @@ Number of tests with other status > `optional` **flaky?**: `number` -Defined in: [types.ts:89](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L89) +Defined in: [types.ts:91](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L91) Number of flaky tests @@ -86,7 +86,7 @@ Number of flaky tests > `optional` **suites?**: `number` -Defined in: [types.ts:91](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L91) +Defined in: [types.ts:93](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L93) Number of test suites @@ -96,7 +96,7 @@ Number of test suites > **start**: `number` -Defined in: [types.ts:93](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L93) +Defined in: [types.ts:95](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L95) Start timestamp (Unix epoch milliseconds) @@ -106,7 +106,7 @@ Start timestamp (Unix epoch milliseconds) > **stop**: `number` -Defined in: [types.ts:95](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L95) +Defined in: [types.ts:97](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L97) Stop timestamp (Unix epoch milliseconds) @@ -116,7 +116,7 @@ Stop timestamp (Unix epoch milliseconds) > `optional` **duration?**: `number` -Defined in: [types.ts:97](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L97) +Defined in: [types.ts:99](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L99) Total duration in milliseconds @@ -126,6 +126,6 @@ Total duration in milliseconds > `optional` **extra?**: `Record`\<`string`, `unknown`\> -Defined in: [types.ts:99](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L99) +Defined in: [types.ts:101](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L101) Custom metadata diff --git a/docs/interfaces/SummaryOptions.md b/docs/interfaces/SummaryOptions.md index 12ff633..e96f158 100644 --- a/docs/interfaces/SummaryOptions.md +++ b/docs/interfaces/SummaryOptions.md @@ -6,7 +6,7 @@ # Interface: SummaryOptions -Defined in: [types.ts:512](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L512) +Defined in: [types.ts:514](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L514) Options for calculating summary @@ -16,7 +16,7 @@ Options for calculating summary > `optional` **start?**: `number` -Defined in: [types.ts:514](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L514) +Defined in: [types.ts:516](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L516) Start timestamp @@ -26,6 +26,6 @@ Start timestamp > `optional` **stop?**: `number` -Defined in: [types.ts:516](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L516) +Defined in: [types.ts:518](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L518) Stop timestamp diff --git a/docs/interfaces/Test.md b/docs/interfaces/Test.md index d940380..93b9f46 100644 --- a/docs/interfaces/Test.md +++ b/docs/interfaces/Test.md @@ -6,7 +6,7 @@ # Interface: Test -Defined in: [types.ts:107](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L107) +Defined in: [types.ts:109](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L109) Individual test result @@ -16,7 +16,7 @@ Individual test result > `optional` **id?**: `string` -Defined in: [types.ts:109](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L109) +Defined in: [types.ts:111](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L111) Legacy test identifier (UUID); new producers should prefer testId @@ -26,7 +26,7 @@ Legacy test identifier (UUID); new producers should prefer testId > `optional` **testId?**: `string` -Defined in: [types.ts:111](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L111) +Defined in: [types.ts:113](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L113) Stable identifier for the logical test case @@ -36,7 +36,7 @@ Stable identifier for the logical test case > `optional` **executionId?**: `string` -Defined in: [types.ts:113](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L113) +Defined in: [types.ts:115](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L115) Identifier for this specific execution of the test case @@ -46,7 +46,7 @@ Identifier for this specific execution of the test case > **name**: `string` -Defined in: [types.ts:115](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L115) +Defined in: [types.ts:117](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L117) Test name @@ -56,7 +56,7 @@ Test name > **status**: [`TestStatus`](../type-aliases/TestStatus.md) -Defined in: [types.ts:117](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L117) +Defined in: [types.ts:119](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L119) Test execution status @@ -66,7 +66,7 @@ Test execution status > **duration**: `number` -Defined in: [types.ts:119](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L119) +Defined in: [types.ts:121](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L121) Test duration in milliseconds @@ -76,7 +76,7 @@ Test duration in milliseconds > `optional` **start?**: `number` -Defined in: [types.ts:121](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L121) +Defined in: [types.ts:123](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L123) Start timestamp (Unix epoch milliseconds) @@ -86,7 +86,7 @@ Start timestamp (Unix epoch milliseconds) > `optional` **stop?**: `number` -Defined in: [types.ts:123](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L123) +Defined in: [types.ts:125](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L125) Stop timestamp (Unix epoch milliseconds) @@ -96,7 +96,7 @@ Stop timestamp (Unix epoch milliseconds) > `optional` **suite?**: `string`[] -Defined in: [types.ts:125](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L125) +Defined in: [types.ts:127](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L127) Test suite hierarchy @@ -106,7 +106,7 @@ Test suite hierarchy > `optional` **message?**: `string` -Defined in: [types.ts:127](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L127) +Defined in: [types.ts:129](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L129) Error message (for failed tests) @@ -116,7 +116,7 @@ Error message (for failed tests) > `optional` **trace?**: `string` -Defined in: [types.ts:129](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L129) +Defined in: [types.ts:131](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L131) Stack trace (for failed tests) @@ -126,7 +126,7 @@ Stack trace (for failed tests) > `optional` **snippet?**: `string` -Defined in: [types.ts:131](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L131) +Defined in: [types.ts:133](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L133) Code snippet where failure occurred @@ -136,7 +136,7 @@ Code snippet where failure occurred > `optional` **ai?**: `string` -Defined in: [types.ts:133](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L133) +Defined in: [types.ts:135](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L135) AI-generated analysis or suggestion @@ -146,7 +146,7 @@ AI-generated analysis or suggestion > `optional` **line?**: `number` -Defined in: [types.ts:135](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L135) +Defined in: [types.ts:137](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L137) Line number where test is defined or failed @@ -156,7 +156,7 @@ Line number where test is defined or failed > `optional` **rawStatus?**: `string` -Defined in: [types.ts:137](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L137) +Defined in: [types.ts:139](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L139) Original status from the test framework @@ -166,7 +166,7 @@ Original status from the test framework > `optional` **tags?**: `string`[] -Defined in: [types.ts:139](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L139) +Defined in: [types.ts:141](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L141) Tags for categorization @@ -176,7 +176,7 @@ Tags for categorization > `optional` **labels?**: `Record`\<`string`, [`LabelValue`](../type-aliases/LabelValue.md)\> -Defined in: [types.ts:141](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L141) +Defined in: [types.ts:143](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L143) Structured key-value metadata; values may be scalar or multi-valued @@ -186,7 +186,7 @@ Structured key-value metadata; values may be scalar or multi-valued > `optional` **type?**: `string` -Defined in: [types.ts:143](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L143) +Defined in: [types.ts:145](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L145) Test type (e.g., 'unit', 'integration', 'e2e') @@ -196,7 +196,7 @@ Test type (e.g., 'unit', 'integration', 'e2e') > `optional` **filePath?**: `string` -Defined in: [types.ts:145](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L145) +Defined in: [types.ts:147](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L147) Path to the test file @@ -206,7 +206,7 @@ Path to the test file > `optional` **retries?**: `number` -Defined in: [types.ts:147](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L147) +Defined in: [types.ts:149](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L149) Number of times the test was re-executed after its initial attempt @@ -216,7 +216,7 @@ Number of times the test was re-executed after its initial attempt > `optional` **retryAttempts?**: [`AttemptHistoryEntry`](AttemptHistoryEntry.md)[] -Defined in: [types.ts:149](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L149) +Defined in: [types.ts:151](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L151) Ordered history of attempts completed before the final attempt @@ -226,7 +226,7 @@ Ordered history of attempts completed before the final attempt > `optional` **flaky?**: `boolean` -Defined in: [types.ts:151](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L151) +Defined in: [types.ts:153](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L153) Whether the test is flaky @@ -236,7 +236,7 @@ Whether the test is flaky > `optional` **stdout?**: `string`[] -Defined in: [types.ts:153](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L153) +Defined in: [types.ts:155](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L155) Standard output captured during test @@ -246,7 +246,7 @@ Standard output captured during test > `optional` **stderr?**: `string`[] -Defined in: [types.ts:155](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L155) +Defined in: [types.ts:157](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L157) Standard error captured during test @@ -256,7 +256,7 @@ Standard error captured during test > `optional` **threadId?**: `string` -Defined in: [types.ts:157](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L157) +Defined in: [types.ts:159](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L159) Thread/worker ID that ran this test @@ -266,7 +266,7 @@ Thread/worker ID that ran this test > `optional` **browser?**: `string` -Defined in: [types.ts:159](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L159) +Defined in: [types.ts:161](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L161) Browser name (for browser tests) @@ -276,7 +276,7 @@ Browser name (for browser tests) > `optional` **device?**: `string` -Defined in: [types.ts:161](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L161) +Defined in: [types.ts:163](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L163) Device name (for device tests) @@ -286,7 +286,7 @@ Device name (for device tests) > `optional` **screenshot?**: `string` -Defined in: [types.ts:163](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L163) +Defined in: [types.ts:165](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L165) Base64 encoded screenshot @@ -296,7 +296,7 @@ Base64 encoded screenshot > `optional` **attachments?**: [`Attachment`](Attachment.md)[] -Defined in: [types.ts:165](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L165) +Defined in: [types.ts:167](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L167) File attachments @@ -306,7 +306,7 @@ File attachments > `optional` **parameters?**: `Record`\<`string`, `unknown`\> -Defined in: [types.ts:167](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L167) +Defined in: [types.ts:169](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L169) Test parameters (for parameterized tests) @@ -316,7 +316,7 @@ Test parameters (for parameterized tests) > `optional` **steps?**: [`Step`](Step.md)[] -Defined in: [types.ts:169](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L169) +Defined in: [types.ts:171](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L171) Test steps @@ -326,7 +326,7 @@ Test steps > `optional` **insights?**: [`TestInsights`](TestInsights.md) -Defined in: [types.ts:171](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L171) +Defined in: [types.ts:173](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L173) Test-level insights @@ -336,6 +336,6 @@ Test-level insights > `optional` **extra?**: `Record`\<`string`, `unknown`\> -Defined in: [types.ts:173](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L173) +Defined in: [types.ts:175](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L175) Custom metadata diff --git a/docs/interfaces/TestBuilderOptions.md b/docs/interfaces/TestBuilderOptions.md index 4e44684..47949aa 100644 --- a/docs/interfaces/TestBuilderOptions.md +++ b/docs/interfaces/TestBuilderOptions.md @@ -6,7 +6,7 @@ # Interface: TestBuilderOptions -Defined in: [types.ts:502](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L502) +Defined in: [types.ts:504](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L504) Options for TestBuilder @@ -16,6 +16,6 @@ Options for TestBuilder > `optional` **autoGenerateId?**: `boolean` -Defined in: [types.ts:504](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L504) +Defined in: [types.ts:506](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L506) Automatically generate test ID diff --git a/docs/interfaces/TestInsights.md b/docs/interfaces/TestInsights.md index 2b0b8f6..7171af5 100644 --- a/docs/interfaces/TestInsights.md +++ b/docs/interfaces/TestInsights.md @@ -6,7 +6,7 @@ # Interface: TestInsights -Defined in: [types.ts:346](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L346) +Defined in: [types.ts:348](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L348) Test-level insights computed from historical data @@ -16,7 +16,7 @@ Test-level insights computed from historical data > `optional` **passRate?**: [`MetricDelta`](MetricDelta.md) -Defined in: [types.ts:348](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L348) +Defined in: [types.ts:350](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L350) Pass rate metric @@ -26,7 +26,7 @@ Pass rate metric > `optional` **failRate?**: [`MetricDelta`](MetricDelta.md) -Defined in: [types.ts:350](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L350) +Defined in: [types.ts:352](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L352) Fail rate metric @@ -36,7 +36,7 @@ Fail rate metric > `optional` **flakyRate?**: [`MetricDelta`](MetricDelta.md) -Defined in: [types.ts:352](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L352) +Defined in: [types.ts:354](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L354) Flaky rate metric @@ -46,7 +46,7 @@ Flaky rate metric > `optional` **averageTestDuration?**: [`MetricDelta`](MetricDelta.md) -Defined in: [types.ts:354](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L354) +Defined in: [types.ts:356](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L356) Average test duration metric @@ -56,7 +56,7 @@ Average test duration metric > `optional` **p95TestDuration?**: [`MetricDelta`](MetricDelta.md) -Defined in: [types.ts:356](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L356) +Defined in: [types.ts:358](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L358) 95th percentile test duration metric @@ -66,7 +66,7 @@ Defined in: [types.ts:356](https://github.com/ctrf-io/ctrf-js/blob/main/src/type > `optional` **executedInRuns?**: `number` -Defined in: [types.ts:358](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L358) +Defined in: [types.ts:360](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L360) Number of runs this test was executed in @@ -76,6 +76,6 @@ Number of runs this test was executed in > `optional` **extra?**: `Record`\<`string`, `unknown`\> -Defined in: [types.ts:360](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L360) +Defined in: [types.ts:362](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L362) Custom metadata diff --git a/docs/interfaces/Tool.md b/docs/interfaces/Tool.md index 8a4bff4..551d2ed 100644 --- a/docs/interfaces/Tool.md +++ b/docs/interfaces/Tool.md @@ -6,7 +6,7 @@ # Interface: Tool -Defined in: [types.ts:61](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L61) +Defined in: [types.ts:63](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L63) Test tool information @@ -16,7 +16,7 @@ Test tool information > **name**: `string` -Defined in: [types.ts:63](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L63) +Defined in: [types.ts:65](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L65) Name of the test tool (e.g., 'jest', 'playwright') @@ -26,7 +26,7 @@ Name of the test tool (e.g., 'jest', 'playwright') > `optional` **version?**: `string` -Defined in: [types.ts:65](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L65) +Defined in: [types.ts:67](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L67) Version of the test tool @@ -36,6 +36,6 @@ Version of the test tool > `optional` **extra?**: `Record`\<`string`, `unknown`\> -Defined in: [types.ts:67](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L67) +Defined in: [types.ts:69](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L69) Custom metadata diff --git a/docs/interfaces/ValidateOptions.md b/docs/interfaces/ValidateOptions.md index 687912a..3f86452 100644 --- a/docs/interfaces/ValidateOptions.md +++ b/docs/interfaces/ValidateOptions.md @@ -6,7 +6,7 @@ # Interface: ValidateOptions -Defined in: [types.ts:546](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L546) +Defined in: [types.ts:548](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L548) Options for validation @@ -14,8 +14,8 @@ Options for validation ### specVersion? -> `optional` **specVersion?**: `string` +> `optional` **specVersion?**: [`SchemaSelector`](../type-aliases/SchemaSelector.md) -Defined in: [types.ts:548](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L548) +Defined in: [types.ts:550](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L550) -Specific spec version to validate against +Specific spec version to validate against, or `latest` (default) diff --git a/docs/interfaces/ValidationErrorDetail.md b/docs/interfaces/ValidationErrorDetail.md index 46b3bfb..d7f4dd3 100644 --- a/docs/interfaces/ValidationErrorDetail.md +++ b/docs/interfaces/ValidationErrorDetail.md @@ -6,7 +6,7 @@ # Interface: ValidationErrorDetail -Defined in: [types.ts:422](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L422) +Defined in: [types.ts:424](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L424) Details of a validation error @@ -16,7 +16,7 @@ Details of a validation error > **message**: `string` -Defined in: [types.ts:424](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L424) +Defined in: [types.ts:426](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L426) Human-readable error message @@ -26,7 +26,7 @@ Human-readable error message > **path**: `string` -Defined in: [types.ts:426](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L426) +Defined in: [types.ts:428](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L428) JSON path to the error location @@ -36,6 +36,6 @@ JSON path to the error location > **keyword**: `string` -Defined in: [types.ts:428](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L428) +Defined in: [types.ts:430](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L430) JSON Schema or semantic validation keyword that failed diff --git a/docs/interfaces/ValidationResult.md b/docs/interfaces/ValidationResult.md index fb03548..adb957e 100644 --- a/docs/interfaces/ValidationResult.md +++ b/docs/interfaces/ValidationResult.md @@ -6,7 +6,7 @@ # Interface: ValidationResult -Defined in: [types.ts:410](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L410) +Defined in: [types.ts:412](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L412) Result of schema validation @@ -16,7 +16,7 @@ Result of schema validation > **valid**: `boolean` -Defined in: [types.ts:412](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L412) +Defined in: [types.ts:414](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L414) Whether the report is valid @@ -26,6 +26,6 @@ Whether the report is valid > **errors**: [`ValidationErrorDetail`](ValidationErrorDetail.md)[] -Defined in: [types.ts:414](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L414) +Defined in: [types.ts:416](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L416) Array of schema or semantic validation errors diff --git a/docs/type-aliases/LabelPrimitive.md b/docs/type-aliases/LabelPrimitive.md index 48e3878..74d52c2 100644 --- a/docs/type-aliases/LabelPrimitive.md +++ b/docs/type-aliases/LabelPrimitive.md @@ -8,6 +8,6 @@ > **LabelPrimitive** = `string` \| `number` \| `boolean` -Defined in: [types.ts:184](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L184) +Defined in: [types.ts:186](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L186) Primitive value supported by a test label diff --git a/docs/type-aliases/LabelValue.md b/docs/type-aliases/LabelValue.md index 792ff1c..d54d248 100644 --- a/docs/type-aliases/LabelValue.md +++ b/docs/type-aliases/LabelValue.md @@ -8,6 +8,6 @@ > **LabelValue** = [`LabelPrimitive`](LabelPrimitive.md) \| \[[`LabelPrimitive`](LabelPrimitive.md), `...LabelPrimitive[]`\] -Defined in: [types.ts:187](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L187) +Defined in: [types.ts:189](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L189) Scalar or non-empty multi-valued test label value diff --git a/docs/type-aliases/RetryAttempt.md b/docs/type-aliases/RetryAttempt.md index 4221b81..a80f2c1 100644 --- a/docs/type-aliases/RetryAttempt.md +++ b/docs/type-aliases/RetryAttempt.md @@ -8,7 +8,7 @@ > **RetryAttempt** = [`AttemptHistoryEntry`](../interfaces/AttemptHistoryEntry.md) -Defined in: [types.ts:235](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L235) +Defined in: [types.ts:237](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L237) Backward-compatible name for an attempt history entry. diff --git a/docs/type-aliases/SchemaSelector.md b/docs/type-aliases/SchemaSelector.md new file mode 100644 index 0000000..3dee149 --- /dev/null +++ b/docs/type-aliases/SchemaSelector.md @@ -0,0 +1,13 @@ +[**CTRF**](../README.md) + +*** + +[CTRF](../globals.md) / SchemaSelector + +# Type Alias: SchemaSelector + +> **SchemaSelector** = [`SupportedSpecVersion`](SupportedSpecVersion.md) \| `"latest"` + +Defined in: [constants.ts:33](https://github.com/ctrf-io/ctrf-js/blob/main/src/constants.ts#L33) + +A published CTRF specification version or the current-version alias diff --git a/docs/type-aliases/SupportedSpecVersion.md b/docs/type-aliases/SupportedSpecVersion.md new file mode 100644 index 0000000..72495ac --- /dev/null +++ b/docs/type-aliases/SupportedSpecVersion.md @@ -0,0 +1,13 @@ +[**CTRF**](../README.md) + +*** + +[CTRF](../globals.md) / SupportedSpecVersion + +# Type Alias: SupportedSpecVersion + +> **SupportedSpecVersion** = *typeof* [`SUPPORTED_SPEC_VERSIONS`](../variables/SUPPORTED_SPEC_VERSIONS.md)\[`number`\] + +Defined in: [constants.ts:30](https://github.com/ctrf-io/ctrf-js/blob/main/src/constants.ts#L30) + +A published CTRF specification version supported by this package diff --git a/docs/type-aliases/TestStatus.md b/docs/type-aliases/TestStatus.md index a2bc01e..db68a4e 100644 --- a/docs/type-aliases/TestStatus.md +++ b/docs/type-aliases/TestStatus.md @@ -8,6 +8,6 @@ > **TestStatus** = `"passed"` \| `"failed"` \| `"skipped"` \| `"pending"` \| `"other"` -Defined in: [types.ts:181](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L181) +Defined in: [types.ts:183](https://github.com/ctrf-io/ctrf-js/blob/main/src/types.ts#L183) Test status enum diff --git a/docs/variables/CTRF_NAMESPACE.md b/docs/variables/CTRF_NAMESPACE.md index 564b897..6186cf1 100644 --- a/docs/variables/CTRF_NAMESPACE.md +++ b/docs/variables/CTRF_NAMESPACE.md @@ -8,6 +8,6 @@ > `const` **CTRF\_NAMESPACE**: `"6ba7b810-9dad-11d1-80b4-00c04fd430c8"` = `"6ba7b810-9dad-11d1-80b4-00c04fd430c8"` -Defined in: [constants.ts:24](https://github.com/ctrf-io/ctrf-js/blob/main/src/constants.ts#L24) +Defined in: [constants.ts:36](https://github.com/ctrf-io/ctrf-js/blob/main/src/constants.ts#L36) CTRF namespace UUID for deterministic ID generation diff --git a/docs/variables/CURRENT_SPEC_VERSION.md b/docs/variables/CURRENT_SPEC_VERSION.md index 81ec081..d81c778 100644 --- a/docs/variables/CURRENT_SPEC_VERSION.md +++ b/docs/variables/CURRENT_SPEC_VERSION.md @@ -6,7 +6,7 @@ # Variable: CURRENT\_SPEC\_VERSION -> `const` **CURRENT\_SPEC\_VERSION**: `"0.0.0"` = `"0.0.0"` +> `const` **CURRENT\_SPEC\_VERSION**: `"0.1.0"` = `"0.1.0"` Defined in: [constants.ts:9](https://github.com/ctrf-io/ctrf-js/blob/main/src/constants.ts#L9) diff --git a/docs/variables/SUPPORTED_SPEC_VERSIONS.md b/docs/variables/SUPPORTED_SPEC_VERSIONS.md index 763388c..817ce47 100644 --- a/docs/variables/SUPPORTED_SPEC_VERSIONS.md +++ b/docs/variables/SUPPORTED_SPEC_VERSIONS.md @@ -6,7 +6,7 @@ # Variable: SUPPORTED\_SPEC\_VERSIONS -> `const` **SUPPORTED\_SPEC\_VERSIONS**: readonly \[`"0.0.0"`\] +> `const` **SUPPORTED\_SPEC\_VERSIONS**: readonly \[`"0.0.1"`, `"0.0.2"`, `"0.0.3"`, `"0.0.4"`, `"0.1.0"`\] Defined in: [constants.ts:21](https://github.com/ctrf-io/ctrf-js/blob/main/src/constants.ts#L21) diff --git a/docs/variables/schema.md b/docs/variables/schema.md index a6ef676..71a8155 100644 --- a/docs/variables/schema.md +++ b/docs/variables/schema.md @@ -8,7 +8,7 @@ > `const` **schema**: `object` -Defined in: [schema.ts:52](https://github.com/ctrf-io/ctrf-js/blob/main/src/schema.ts#L52) +Defined in: [schema.ts:65](https://github.com/ctrf-io/ctrf-js/blob/main/src/schema.ts#L65) ## Example diff --git a/package-lock.json b/package-lock.json index a49c612..c2108ff 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "ctrf", - "version": "0.3.1", + "version": "0.4.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "ctrf", - "version": "0.3.1", + "version": "0.4.0", "license": "MIT", "dependencies": { "ajv": "8.20.0", diff --git a/package.json b/package.json index f50cf44..293427e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ctrf", - "version": "0.3.1", + "version": "0.4.0", "description": "CTRF reference implementation in TypeScript for creating and validating CTRF documents.", "type": "module", "main": "dist/index.cjs", diff --git a/src/README.md b/src/README.md index 04f74df..bb36c7e 100644 --- a/src/README.md +++ b/src/README.md @@ -233,8 +233,8 @@ const updated = ctrf.recalculateSummary(report) import { ctrf } from 'ctrf' ctrf.REPORT_FORMAT // 'ctrf' -ctrf.CURRENT_SPEC_VERSION // '1.0.0' -ctrf.SUPPORTED_SPEC_VERSIONS // ['1.0.0'] +ctrf.CURRENT_SPEC_VERSION // '0.1.0' +ctrf.SUPPORTED_SPEC_VERSIONS // ['0.0.1', '0.0.2', '0.0.3', '0.0.4', '0.1.0'] ctrf.TEST_STATUSES // ['passed', 'failed', 'skipped', 'pending', 'other'] ctrf.CTRF_NAMESPACE // UUID namespace for deterministic IDs ``` @@ -262,12 +262,13 @@ try { ```typescript import { ctrf } from 'ctrf' -// Get the JSON Schema -const schema = ctrf.getSchema() +// Get a historical schema or the latest published schema +const historicalSchema = ctrf.getSchema('0.0.2') +const latestSchema = ctrf.getSchema('latest') // Get version info -const version = ctrf.getCurrentSpecVersion() // '1.0.0' -const supported = ctrf.getSupportedSpecVersions() // ['1.0.0'] +const version = ctrf.getCurrentSpecVersion() // '0.1.0' +const supported = ctrf.getSupportedSpecVersions() // ['0.0.1', '0.0.2', '0.0.3', '0.0.4', '0.1.0'] ``` ## Design Principles diff --git a/src/builder.ts b/src/builder.ts index 406309b..cf3e979 100644 --- a/src/builder.ts +++ b/src/builder.ts @@ -34,7 +34,7 @@ import { BuilderError } from "./errors.js"; * @example * ```typescript * const report = new ReportBuilder() - * .specVersion('1.0.0') + * .specVersion('0.1.0') * .tool({ name: 'jest', version: '29.0.0' }) * .environment({ branchName: 'main' }) * .addTest( diff --git a/src/constants.test.ts b/src/constants.test.ts index d803698..9ad5c8b 100644 --- a/src/constants.test.ts +++ b/src/constants.test.ts @@ -18,6 +18,10 @@ describe("constants", () => { it("should be a valid semver string", () => { expect(CURRENT_SPEC_VERSION).toMatch(/^\d+\.\d+\.\d+$/); }); + + it("should identify the latest published specification", () => { + expect(CURRENT_SPEC_VERSION).toBe("0.1.0"); + }); }); describe("TEST_STATUSES", () => { @@ -38,6 +42,16 @@ describe("constants", () => { it("should include the current version", () => { expect(SUPPORTED_SPEC_VERSIONS).toContain(CURRENT_SPEC_VERSION); }); + + it("should contain every published CTRF specification version", () => { + expect(SUPPORTED_SPEC_VERSIONS).toEqual([ + "0.0.1", + "0.0.2", + "0.0.3", + "0.0.4", + "0.1.0", + ]); + }); }); describe("CTRF_NAMESPACE", () => { diff --git a/src/constants.ts b/src/constants.ts index b0fd577..c474295 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -6,7 +6,7 @@ export const REPORT_FORMAT = "CTRF" as const; /** Current spec version */ -export const CURRENT_SPEC_VERSION = "0.0.0"; +export const CURRENT_SPEC_VERSION = "0.1.0"; /** All valid test statuses */ export const TEST_STATUSES = [ @@ -18,7 +18,19 @@ export const TEST_STATUSES = [ ] as const; /** Supported specification versions */ -export const SUPPORTED_SPEC_VERSIONS = ["0.0.0"] as const; +export const SUPPORTED_SPEC_VERSIONS = [ + "0.0.1", + "0.0.2", + "0.0.3", + "0.0.4", + "0.1.0", +] as const; + +/** A published CTRF specification version supported by this package */ +export type SupportedSpecVersion = (typeof SUPPORTED_SPEC_VERSIONS)[number]; + +/** A published CTRF specification version or the current-version alias */ +export type SchemaSelector = SupportedSpecVersion | "latest"; /** CTRF namespace UUID for deterministic ID generation */ export const CTRF_NAMESPACE = "6ba7b810-9dad-11d1-80b4-00c04fd430c8"; diff --git a/src/ctrf-schema-0.0.1.json b/src/ctrf-schema-0.0.1.json new file mode 100644 index 0000000..6849be1 --- /dev/null +++ b/src/ctrf-schema-0.0.1.json @@ -0,0 +1,638 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "CTRF JSON Schema", + "description": "Common Test Report Format - an open standard JSON format for test results reports", + "type": "object", + "required": [ "results", "reportFormat", "specVersion" ], + "properties": { + "reportFormat": { + "description": "Document format identifier. Must be 'CTRF'", + "const": "CTRF" + }, + "specVersion": { + "description": "CTRF specification version in SemVer format (MAJOR.MINOR.PATCH)", + "type": "string", + "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$" + }, + "reportId": { + "description": "Unique identifier for this report instance (UUID)", + "type": "string", + "format": "uuid" + }, + "timestamp": { + "description": "Report generation time (RFC 3339 / ISO 8601)", + "type": "string", + "format": "date-time" + }, + "generatedBy": { + "description": "Tool or system that produced this CTRF document", + "type": "string" + }, + "extra": { + "description": "Extension point for arbitrary metadata", + "type": "object" + }, + "results": { + "description": "Results of a single test execution run", + "type": "object", + "required": [ "tool", "summary", "tests" ], + "properties": { + "tool": { + "description": "Tool or framework that produced the test results", + "type": "object", + "required": [ "name" ], + "properties": { + "name": { + "description": "Name of the testing tool or framework", + "type": "string", + "minLength": 1 + }, + "version": { + "description": "Version of the testing tool", + "type": "string" + }, + "extra": { + "description": "Extension point for arbitrary metadata", + "type": "object" + } + }, + "additionalProperties": false + }, + "summary": { + "description": "Aggregated statistics and timing for the test run", + "type": "object", + "required": [ + "tests", + "passed", + "failed", + "skipped", + "pending", + "other", + "start", + "stop" + ], + "properties": { + "tests": { + "description": "Total number of tests executed", + "type": "integer" + }, + "passed": { + "description": "Count of tests with status 'passed'", + "type": "integer" + }, + "failed": { + "description": "Count of tests with status 'failed'", + "type": "integer" + }, + "skipped": { + "description": "Count of tests with status 'skipped'", + "type": "integer" + }, + "pending": { + "description": "Count of tests with status 'pending'", + "type": "integer" + }, + "other": { + "description": "Count of tests with status 'other'", + "type": "integer" + }, + "flaky": { + "description": "Count of flaky tests (passed after failed attempts)", + "type": "integer" + }, + "suites": { + "description": "Number of test suites in the run", + "type": "integer" + }, + "start": { + "description": "Run start time (milliseconds since Unix epoch)", + "type": "integer" + }, + "stop": { + "description": "Run end time (milliseconds since Unix epoch)", + "type": "integer" + }, + "duration": { + "description": "Total run duration (milliseconds)", + "type": "integer" + }, + "extra": { + "description": "Extension point for arbitrary metadata", + "type": "object" + } + }, + "additionalProperties": false + }, + "tests": { + "description": "List of test cases executed during the run", + "type": "array", + "items": { + "description": "Individual test case result", + "type": "object", + "required": [ "name", "status", "duration" ], + "properties": { + "id": { + "description": "Unique, stable identifier for the test case (UUID)", + "type": "string", + "format": "uuid" + }, + "name": { + "description": "Name or title of the test case", + "type": "string", + "minLength": 1 + }, + "status": { + "description": "Final outcome of the test case", + "enum": [ "passed", "failed", "skipped", "pending", "other" ] + }, + "duration": { + "description": "Test execution time (milliseconds)", + "type": "integer" + }, + "start": { + "description": "Test start time (milliseconds since Unix epoch)", + "type": "integer" + }, + "stop": { + "description": "Test end time (milliseconds since Unix epoch)", + "type": "integer" + }, + "suite": { + "description": "Suite hierarchy from top-level to immediate parent", + "type": "array", + "minItems": 1, + "items": { + "type": "string" + } + }, + "message": { + "description": "Error or failure message", + "type": "string" + }, + "trace": { + "description": "Stack trace or failure trace information", + "type": "string" + }, + "snippet": { + "description": "Code snippet associated with the failure", + "type": "string" + }, + "ai": { + "description": "AI-generated diagnostic data or suggestions", + "type": "string" + }, + "line": { + "description": "Line number of the test definition", + "type": "integer" + }, + "rawStatus": { + "description": "Original status from source tool before normalization", + "type": "string" + }, + "tags": { + "description": "User-defined tags", + "type": "array", + "items": { + "type": "string" + } + }, + "type": { + "description": "Test classification (e.g., 'unit', 'integration', 'e2e')", + "type": "string" + }, + "filePath": { + "description": "Path to the file defining this test", + "type": "string" + }, + "retries": { + "description": "Number of retry attempts performed", + "type": "integer" + }, + "retryAttempts": { + "description": "List of retry attempts for this test", + "type": "array", + "items": { + "description": "Single retry attempt result", + "type": "object", + "required": [ "attempt", "status" ], + "properties": { + "attempt": { + "description": "Attempt number (1 = first execution)", + "type": "integer", + "minimum": 1 + }, + "status": { + "description": "Outcome of this attempt", + "enum": [ + "passed", + "failed", + "skipped", + "pending", + "other" + ] + }, + "duration": { + "description": "Attempt execution time (milliseconds)", + "type": "integer" + }, + "message": { + "description": "Error or failure message for this attempt", + "type": "string" + }, + "trace": { + "description": "Stack trace for this attempt", + "type": "string" + }, + "line": { + "description": "Line number associated with failure", + "type": "integer" + }, + "snippet": { + "description": "Code snippet for this attempt", + "type": "string" + }, + "stdout": { + "description": "Standard output lines from this attempt", + "type": "array", + "items": { + "type": "string" + } + }, + "stderr": { + "description": "Standard error lines from this attempt", + "type": "array", + "items": { + "type": "string" + } + }, + "start": { + "description": "Attempt start time (milliseconds since Unix epoch)", + "type": "integer" + }, + "stop": { + "description": "Attempt end time (milliseconds since Unix epoch)", + "type": "integer" + }, + "attachments": { + "description": "Artifacts from this attempt", + "type": "array", + "items": { + "description": "External file or resource reference", + "type": "object", + "required": [ "name", "contentType", "path" ], + "properties": { + "name": { + "description": "Display name of the attachment", + "type": "string" + }, + "contentType": { + "description": "MIME type of the attachment", + "type": "string" + }, + "path": { + "description": "Path or URI to the attachment", + "type": "string" + }, + "extra": { + "description": "Extension point for arbitrary metadata", + "type": "object" + } + }, + "additionalProperties": false + } + }, + "extra": { + "description": "Extension point for arbitrary metadata", + "type": "object" + } + }, + "additionalProperties": false + } + }, + "flaky": { + "description": "True if test passed after one or more failed attempts", + "type": "boolean" + }, + "stdout": { + "description": "Standard output lines from test execution", + "type": "array", + "items": { + "type": "string" + } + }, + "stderr": { + "description": "Standard error lines from test execution", + "type": "array", + "items": { + "type": "string" + } + }, + "threadId": { + "description": "Thread or worker identifier", + "type": "string" + }, + "browser": { + "description": "Browser used for browser-based tests", + "type": "string" + }, + "device": { + "description": "Device or device profile used", + "type": "string" + }, + "screenshot": { + "description": "Single base64-encoded screenshot image", + "type": "string" + }, + "attachments": { + "description": "Additional artifacts (screenshots, logs, videos, etc.)", + "type": "array", + "items": { + "description": "External file or resource reference", + "type": "object", + "required": [ "name", "contentType", "path" ], + "properties": { + "name": { + "description": "Display name of the attachment", + "type": "string" + }, + "contentType": { + "description": "MIME type of the attachment", + "type": "string" + }, + "path": { + "description": "Path or URI to the attachment", + "type": "string" + }, + "extra": { + "description": "Extension point for arbitrary metadata", + "type": "object" + } + }, + "additionalProperties": false + } + }, + "parameters": { + "description": "Test parameters or input values", + "type": "object" + }, + "steps": { + "description": "Test steps or sub-operations", + "type": "array", + "items": { + "description": "Individual test step", + "type": "object", + "required": [ "name", "status" ], + "properties": { + "name": { + "description": "Name of the step", + "type": "string" + }, + "status": { + "description": "Outcome of the step", + "enum": [ + "passed", + "failed", + "skipped", + "pending", + "other" + ] + }, + "extra": { + "description": "Extension point for arbitrary metadata", + "type": "object" + } + }, + "additionalProperties": false + } + }, + "insights": { + "description": "Derived metrics for this test across runs", + "type": "object", + "properties": { + "passRate": { + "description": "Pass rate metric with baseline comparison", + "$ref": "#/definitions/metricDelta" + }, + "failRate": { + "description": "Fail rate metric with baseline comparison", + "$ref": "#/definitions/metricDelta" + }, + "flakyRate": { + "description": "Flaky rate metric with baseline comparison", + "$ref": "#/definitions/metricDelta" + }, + "averageTestDuration": { + "description": "Average duration metric with baseline comparison", + "$ref": "#/definitions/metricDelta" + }, + "p95TestDuration": { + "description": "95th percentile duration with baseline comparison", + "$ref": "#/definitions/metricDelta" + }, + "executedInRuns": { + "description": "Number of runs this test was executed in", + "type": "integer" + }, + "extra": { + "description": "Extension point for arbitrary metadata", + "type": "object" + } + }, + "additionalProperties": false + }, + "extra": { + "description": "Extension point for arbitrary metadata", + "type": "object" + } + }, + "additionalProperties": false + } + }, + "environment": { + "description": "Execution environment, system configuration, and build context", + "type": "object", + "properties": { + "reportName": { + "description": "Human-readable name for this report", + "type": "string" + }, + "appName": { + "description": "Name of the application under test", + "type": "string" + }, + "appVersion": { + "description": "Version of the application under test", + "type": "string" + }, + "buildId": { + "description": "Unique identifier for the CI/CD build", + "type": "string" + }, + "buildName": { + "description": "Name of the CI/CD build or pipeline", + "type": "string" + }, + "buildNumber": { + "description": "Sequential build number", + "type": "integer" + }, + "buildUrl": { + "description": "URL to the CI/CD build", + "type": "string" + }, + "repositoryName": { + "description": "Name of the source code repository", + "type": "string" + }, + "repositoryUrl": { + "description": "URL of the source code repository", + "type": "string" + }, + "commit": { + "description": "Git commit SHA or VCS revision identifier", + "type": "string" + }, + "branchName": { + "description": "Git branch or VCS branch name", + "type": "string" + }, + "osPlatform": { + "description": "Operating system platform (e.g., 'linux', 'darwin', 'win32')", + "type": "string" + }, + "osRelease": { + "description": "Operating system release version", + "type": "string" + }, + "osVersion": { + "description": "Operating system version string", + "type": "string" + }, + "testEnvironment": { + "description": "Logical test environment (e.g., 'staging', 'production')", + "type": "string" + }, + "healthy": { + "description": "Indicates if the run is considered healthy", + "type": "boolean" + }, + "extra": { + "description": "Extension point for arbitrary metadata", + "type": "object" + } + }, + "additionalProperties": false + }, + "extra": { + "description": "Extension point for arbitrary metadata", + "type": "object" + } + }, + "additionalProperties": false + }, + "insights": { + "description": "Aggregated metrics computed across multiple test runs", + "type": "object", + "properties": { + "passRate": { + "description": "Overall pass rate with baseline comparison", + "$ref": "#/definitions/metricDelta" + }, + "failRate": { + "description": "Overall fail rate with baseline comparison", + "$ref": "#/definitions/metricDelta" + }, + "flakyRate": { + "description": "Overall flaky rate with baseline comparison", + "$ref": "#/definitions/metricDelta" + }, + "averageRunDuration": { + "description": "Average run duration with baseline comparison", + "$ref": "#/definitions/metricDelta" + }, + "p95RunDuration": { + "description": "95th percentile run duration with baseline comparison", + "$ref": "#/definitions/metricDelta" + }, + "averageTestDuration": { + "description": "Average test duration with baseline comparison", + "$ref": "#/definitions/metricDelta" + }, + "runsAnalyzed": { + "description": "Number of historical runs analyzed for insights", + "type": "integer" + }, + "extra": { + "description": "Extension point for arbitrary metadata", + "type": "object" + } + }, + "additionalProperties": false + }, + "baseline": { + "description": "Reference to a previous report used for comparison", + "type": "object", + "required": [ "reportId" ], + "properties": { + "reportId": { + "description": "UUID of the baseline report", + "type": "string", + "format": "uuid" + }, + "timestamp": { + "description": "Generation time of the baseline report", + "type": "string", + "format": "date-time" + }, + "source": { + "description": "Origin or location of the baseline report", + "type": "string" + }, + "buildNumber": { + "description": "Build number of the baseline run", + "type": "integer" + }, + "buildName": { + "description": "Build name of the baseline run", + "type": "string" + }, + "buildUrl": { + "description": "URL to the baseline build", + "type": "string", + "format": "uri" + }, + "commit": { + "description": "Git commit SHA of the baseline run", + "type": "string" + }, + "extra": { + "description": "Extension point for arbitrary metadata", + "type": "object" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false, + "definitions": { + "metricDelta": { + "description": "Metric value with baseline comparison", + "type": "object", + "properties": { + "current": { + "description": "Current metric value", + "type": "number" + }, + "baseline": { + "description": "Baseline metric value for comparison", + "type": "number" + }, + "change": { + "description": "Computed difference between current and baseline", + "type": "number" + } + }, + "additionalProperties": false + } + } +} diff --git a/src/ctrf-schema-0.0.2.json b/src/ctrf-schema-0.0.2.json new file mode 100644 index 0000000..dcaa916 --- /dev/null +++ b/src/ctrf-schema-0.0.2.json @@ -0,0 +1,645 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "CTRF JSON Schema", + "description": "Common Test Report Format - an open standard JSON format for test results reports", + "type": "object", + "required": [ "results", "reportFormat", "specVersion" ], + "properties": { + "reportFormat": { + "description": "Document format identifier. Must be 'CTRF'", + "const": "CTRF" + }, + "specVersion": { + "description": "CTRF specification version in SemVer format (MAJOR.MINOR.PATCH)", + "type": "string", + "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$" + }, + "reportId": { + "description": "Unique identifier for this report instance (UUID)", + "type": "string", + "format": "uuid" + }, + "timestamp": { + "description": "Report generation time (RFC 3339 / ISO 8601)", + "type": "string", + "format": "date-time" + }, + "generatedBy": { + "description": "Tool or system that produced this CTRF document", + "type": "string" + }, + "extra": { + "description": "Extension point for arbitrary metadata", + "type": "object" + }, + "results": { + "description": "Results of a single test execution run", + "type": "object", + "required": [ "tool", "summary", "tests" ], + "properties": { + "tool": { + "description": "Tool or framework that produced the test results", + "type": "object", + "required": [ "name" ], + "properties": { + "name": { + "description": "Name of the testing tool or framework", + "type": "string", + "minLength": 1 + }, + "version": { + "description": "Version of the testing tool", + "type": "string" + }, + "extra": { + "description": "Extension point for arbitrary metadata", + "type": "object" + } + }, + "additionalProperties": false + }, + "summary": { + "description": "Aggregated statistics and timing for the test run", + "type": "object", + "required": [ + "tests", + "passed", + "failed", + "skipped", + "pending", + "other", + "start", + "stop" + ], + "properties": { + "tests": { + "description": "Total number of tests executed", + "type": "integer" + }, + "passed": { + "description": "Count of tests with status 'passed'", + "type": "integer" + }, + "failed": { + "description": "Count of tests with status 'failed'", + "type": "integer" + }, + "skipped": { + "description": "Count of tests with status 'skipped'", + "type": "integer" + }, + "pending": { + "description": "Count of tests with status 'pending'", + "type": "integer" + }, + "other": { + "description": "Count of tests with status 'other'", + "type": "integer" + }, + "flaky": { + "description": "Count of flaky tests (passed after failed attempts)", + "type": "integer" + }, + "suites": { + "description": "Number of test suites in the run", + "type": "integer" + }, + "start": { + "description": "Run start time (milliseconds since Unix epoch)", + "type": "integer" + }, + "stop": { + "description": "Run end time (milliseconds since Unix epoch)", + "type": "integer" + }, + "duration": { + "description": "Total run duration (milliseconds)", + "type": "integer" + }, + "extra": { + "description": "Extension point for arbitrary metadata", + "type": "object" + } + }, + "additionalProperties": false + }, + "tests": { + "description": "List of test cases executed during the run", + "type": "array", + "items": { + "description": "Individual test case result", + "type": "object", + "required": [ "name", "status", "duration" ], + "properties": { + "id": { + "description": "Unique, stable identifier for the test case (UUID)", + "type": "string", + "format": "uuid" + }, + "name": { + "description": "Name or title of the test case", + "type": "string", + "minLength": 1 + }, + "status": { + "description": "Final outcome of the test case", + "enum": [ "passed", "failed", "skipped", "pending", "other" ] + }, + "duration": { + "description": "Test execution time (milliseconds)", + "type": "integer" + }, + "start": { + "description": "Test start time (milliseconds since Unix epoch)", + "type": "integer" + }, + "stop": { + "description": "Test end time (milliseconds since Unix epoch)", + "type": "integer" + }, + "suite": { + "description": "Suite hierarchy from top-level to immediate parent", + "type": "array", + "minItems": 1, + "items": { + "type": "string" + } + }, + "message": { + "description": "Error or failure message", + "type": "string" + }, + "trace": { + "description": "Stack trace or failure trace information", + "type": "string" + }, + "snippet": { + "description": "Code snippet associated with the failure", + "type": "string" + }, + "ai": { + "description": "AI-generated diagnostic data or suggestions", + "type": "string" + }, + "line": { + "description": "Line number of the test definition", + "type": "integer" + }, + "rawStatus": { + "description": "Original status from source tool before normalization", + "type": "string" + }, + "tags": { + "description": "User-defined tags", + "type": "array", + "items": { + "type": "string" + } + }, + "labels": { + "description": "Structured key-value metadata for the test case (e.g. priority, severity, external identifiers)", + "type": "object", + "additionalProperties": { + "type": [ "string", "number", "boolean" ] + } + }, + "type": { + "description": "Test classification (e.g., 'unit', 'integration', 'e2e')", + "type": "string" + }, + "filePath": { + "description": "Path to the file defining this test", + "type": "string" + }, + "retries": { + "description": "Number of retry attempts performed", + "type": "integer" + }, + "retryAttempts": { + "description": "List of retry attempts for this test", + "type": "array", + "items": { + "description": "Single retry attempt result", + "type": "object", + "required": [ "attempt", "status" ], + "properties": { + "attempt": { + "description": "Attempt number (1 = first execution)", + "type": "integer", + "minimum": 1 + }, + "status": { + "description": "Outcome of this attempt", + "enum": [ + "passed", + "failed", + "skipped", + "pending", + "other" + ] + }, + "duration": { + "description": "Attempt execution time (milliseconds)", + "type": "integer" + }, + "message": { + "description": "Error or failure message for this attempt", + "type": "string" + }, + "trace": { + "description": "Stack trace for this attempt", + "type": "string" + }, + "line": { + "description": "Line number associated with failure", + "type": "integer" + }, + "snippet": { + "description": "Code snippet for this attempt", + "type": "string" + }, + "stdout": { + "description": "Standard output lines from this attempt", + "type": "array", + "items": { + "type": "string" + } + }, + "stderr": { + "description": "Standard error lines from this attempt", + "type": "array", + "items": { + "type": "string" + } + }, + "start": { + "description": "Attempt start time (milliseconds since Unix epoch)", + "type": "integer" + }, + "stop": { + "description": "Attempt end time (milliseconds since Unix epoch)", + "type": "integer" + }, + "attachments": { + "description": "Artifacts from this attempt", + "type": "array", + "items": { + "description": "External file or resource reference", + "type": "object", + "required": [ "name", "contentType", "path" ], + "properties": { + "name": { + "description": "Display name of the attachment", + "type": "string" + }, + "contentType": { + "description": "MIME type of the attachment", + "type": "string" + }, + "path": { + "description": "Path or URI to the attachment", + "type": "string" + }, + "extra": { + "description": "Extension point for arbitrary metadata", + "type": "object" + } + }, + "additionalProperties": false + } + }, + "extra": { + "description": "Extension point for arbitrary metadata", + "type": "object" + } + }, + "additionalProperties": false + } + }, + "flaky": { + "description": "True if test passed after one or more failed attempts", + "type": "boolean" + }, + "stdout": { + "description": "Standard output lines from test execution", + "type": "array", + "items": { + "type": "string" + } + }, + "stderr": { + "description": "Standard error lines from test execution", + "type": "array", + "items": { + "type": "string" + } + }, + "threadId": { + "description": "Thread or worker identifier", + "type": "string" + }, + "browser": { + "description": "Browser used for browser-based tests", + "type": "string" + }, + "device": { + "description": "Device or device profile used", + "type": "string" + }, + "screenshot": { + "description": "Single base64-encoded screenshot image", + "type": "string" + }, + "attachments": { + "description": "Additional artifacts (screenshots, logs, videos, etc.)", + "type": "array", + "items": { + "description": "External file or resource reference", + "type": "object", + "required": [ "name", "contentType", "path" ], + "properties": { + "name": { + "description": "Display name of the attachment", + "type": "string" + }, + "contentType": { + "description": "MIME type of the attachment", + "type": "string" + }, + "path": { + "description": "Path or URI to the attachment", + "type": "string" + }, + "extra": { + "description": "Extension point for arbitrary metadata", + "type": "object" + } + }, + "additionalProperties": false + } + }, + "parameters": { + "description": "Test parameters or input values", + "type": "object" + }, + "steps": { + "description": "Test steps or sub-operations", + "type": "array", + "items": { + "description": "Individual test step", + "type": "object", + "required": [ "name", "status" ], + "properties": { + "name": { + "description": "Name of the step", + "type": "string" + }, + "status": { + "description": "Outcome of the step", + "enum": [ + "passed", + "failed", + "skipped", + "pending", + "other" + ] + }, + "extra": { + "description": "Extension point for arbitrary metadata", + "type": "object" + } + }, + "additionalProperties": false + } + }, + "insights": { + "description": "Derived metrics for this test across runs", + "type": "object", + "properties": { + "passRate": { + "description": "Pass rate metric with baseline comparison", + "$ref": "#/definitions/metricDelta" + }, + "failRate": { + "description": "Fail rate metric with baseline comparison", + "$ref": "#/definitions/metricDelta" + }, + "flakyRate": { + "description": "Flaky rate metric with baseline comparison", + "$ref": "#/definitions/metricDelta" + }, + "averageTestDuration": { + "description": "Average duration metric with baseline comparison", + "$ref": "#/definitions/metricDelta" + }, + "p95TestDuration": { + "description": "95th percentile duration with baseline comparison", + "$ref": "#/definitions/metricDelta" + }, + "executedInRuns": { + "description": "Number of runs this test was executed in", + "type": "integer" + }, + "extra": { + "description": "Extension point for arbitrary metadata", + "type": "object" + } + }, + "additionalProperties": false + }, + "extra": { + "description": "Extension point for arbitrary metadata", + "type": "object" + } + }, + "additionalProperties": false + } + }, + "environment": { + "description": "Execution environment, system configuration, and build context", + "type": "object", + "properties": { + "reportName": { + "description": "Human-readable name for this report", + "type": "string" + }, + "appName": { + "description": "Name of the application under test", + "type": "string" + }, + "appVersion": { + "description": "Version of the application under test", + "type": "string" + }, + "buildId": { + "description": "Unique identifier for the CI/CD build", + "type": "string" + }, + "buildName": { + "description": "Name of the CI/CD build or pipeline", + "type": "string" + }, + "buildNumber": { + "description": "Sequential build number", + "type": "integer" + }, + "buildUrl": { + "description": "URL to the CI/CD build", + "type": "string" + }, + "repositoryName": { + "description": "Name of the source code repository", + "type": "string" + }, + "repositoryUrl": { + "description": "URL of the source code repository", + "type": "string" + }, + "commit": { + "description": "Git commit SHA or VCS revision identifier", + "type": "string" + }, + "branchName": { + "description": "Git branch or VCS branch name", + "type": "string" + }, + "osPlatform": { + "description": "Operating system platform (e.g., 'linux', 'darwin', 'win32')", + "type": "string" + }, + "osRelease": { + "description": "Operating system release version", + "type": "string" + }, + "osVersion": { + "description": "Operating system version string", + "type": "string" + }, + "testEnvironment": { + "description": "Logical test environment (e.g., 'staging', 'production')", + "type": "string" + }, + "healthy": { + "description": "Indicates if the run is considered healthy", + "type": "boolean" + }, + "extra": { + "description": "Extension point for arbitrary metadata", + "type": "object" + } + }, + "additionalProperties": false + }, + "extra": { + "description": "Extension point for arbitrary metadata", + "type": "object" + } + }, + "additionalProperties": false + }, + "insights": { + "description": "Aggregated metrics computed across multiple test runs", + "type": "object", + "properties": { + "passRate": { + "description": "Overall pass rate with baseline comparison", + "$ref": "#/definitions/metricDelta" + }, + "failRate": { + "description": "Overall fail rate with baseline comparison", + "$ref": "#/definitions/metricDelta" + }, + "flakyRate": { + "description": "Overall flaky rate with baseline comparison", + "$ref": "#/definitions/metricDelta" + }, + "averageRunDuration": { + "description": "Average run duration with baseline comparison", + "$ref": "#/definitions/metricDelta" + }, + "p95RunDuration": { + "description": "95th percentile run duration with baseline comparison", + "$ref": "#/definitions/metricDelta" + }, + "averageTestDuration": { + "description": "Average test duration with baseline comparison", + "$ref": "#/definitions/metricDelta" + }, + "runsAnalyzed": { + "description": "Number of historical runs analyzed for insights", + "type": "integer" + }, + "extra": { + "description": "Extension point for arbitrary metadata", + "type": "object" + } + }, + "additionalProperties": false + }, + "baseline": { + "description": "Reference to a previous report used for comparison", + "type": "object", + "required": [ "reportId" ], + "properties": { + "reportId": { + "description": "UUID of the baseline report", + "type": "string", + "format": "uuid" + }, + "timestamp": { + "description": "Generation time of the baseline report", + "type": "string", + "format": "date-time" + }, + "source": { + "description": "Origin or location of the baseline report", + "type": "string" + }, + "buildNumber": { + "description": "Build number of the baseline run", + "type": "integer" + }, + "buildName": { + "description": "Build name of the baseline run", + "type": "string" + }, + "buildUrl": { + "description": "URL to the baseline build", + "type": "string", + "format": "uri" + }, + "commit": { + "description": "Git commit SHA of the baseline run", + "type": "string" + }, + "extra": { + "description": "Extension point for arbitrary metadata", + "type": "object" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false, + "definitions": { + "metricDelta": { + "description": "Metric value with baseline comparison", + "type": "object", + "properties": { + "current": { + "description": "Current metric value", + "type": "number" + }, + "baseline": { + "description": "Baseline metric value for comparison", + "type": "number" + }, + "change": { + "description": "Computed difference between current and baseline", + "type": "number" + } + }, + "additionalProperties": false + } + } +} diff --git a/src/ctrf-schema-0.0.3.json b/src/ctrf-schema-0.0.3.json new file mode 100644 index 0000000..2cee012 --- /dev/null +++ b/src/ctrf-schema-0.0.3.json @@ -0,0 +1,710 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "CTRF JSON Schema", + "description": "Common Test Report Format - an open standard JSON format for test results reports", + "type": "object", + "required": [ "results", "reportFormat", "specVersion" ], + "properties": { + "reportFormat": { + "description": "Document format identifier. Must be 'CTRF'", + "const": "CTRF" + }, + "specVersion": { + "description": "CTRF specification version in SemVer format (MAJOR.MINOR.PATCH)", + "type": "string", + "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$" + }, + "reportId": { + "description": "Unique identifier for this CTRF document instance (UUID). Identifies the serialized artifact", + "type": "string", + "format": "uuid", + "minLength": 1 + }, + "runId": { + "description": "Identifier for the logical test run. Shared across shards/documents belonging to the same run", + "type": "string", + "minLength": 1 + }, + "timestamp": { + "description": "Report generation time (RFC 3339 / ISO 8601)", + "type": "string", + "format": "date-time" + }, + "generatedBy": { + "description": "Tool or system that produced this CTRF document", + "type": "string" + }, + "extra": { + "description": "Extension point for arbitrary metadata", + "type": "object" + }, + "results": { + "description": "Results of a single test execution run", + "type": "object", + "required": [ "tool", "summary", "tests" ], + "properties": { + "tool": { + "description": "Tool or framework that produced the test results", + "type": "object", + "required": [ "name" ], + "properties": { + "name": { + "description": "Name of the testing tool or framework", + "type": "string", + "minLength": 1 + }, + "version": { + "description": "Version of the testing tool", + "type": "string" + }, + "extra": { + "description": "Extension point for arbitrary metadata", + "type": "object" + } + }, + "additionalProperties": false + }, + "summary": { + "description": "Aggregated statistics and timing for the test run", + "type": "object", + "required": [ + "tests", + "passed", + "failed", + "skipped", + "pending", + "other", + "start", + "stop" + ], + "properties": { + "tests": { + "description": "Total number of tests executed", + "type": "integer" + }, + "passed": { + "description": "Count of tests with status 'passed'", + "type": "integer" + }, + "failed": { + "description": "Count of tests with status 'failed'", + "type": "integer" + }, + "skipped": { + "description": "Count of tests with status 'skipped'", + "type": "integer" + }, + "pending": { + "description": "Count of tests with status 'pending'", + "type": "integer" + }, + "other": { + "description": "Count of tests with status 'other'", + "type": "integer" + }, + "flaky": { + "description": "Count of flaky tests (passed after failed attempts)", + "type": "integer" + }, + "suites": { + "description": "Number of test suites in the run", + "type": "integer" + }, + "start": { + "description": "Run start time (milliseconds since Unix epoch)", + "type": "integer" + }, + "stop": { + "description": "Run end time (milliseconds since Unix epoch)", + "type": "integer" + }, + "duration": { + "description": "Total run duration (milliseconds)", + "type": "integer" + }, + "extra": { + "description": "Extension point for arbitrary metadata", + "type": "object" + } + }, + "additionalProperties": false + }, + "tests": { + "description": "List of test cases executed during the run", + "type": "array", + "items": { + "description": "Individual test case result", + "type": "object", + "required": [ "name", "status", "duration" ], + "properties": { + "id": { + "description": "Legacy identifier for the test case (UUID). New producers should prefer testId", + "type": "string", + "format": "uuid", + "minLength": 1 + }, + "testId": { + "description": "Stable identifier for the logical test case. Should be derived from stable test attributes when generated by a producer", + "type": "string", + "minLength": 1 + }, + "executionId": { + "description": "Unique identifier for this specific execution of the test case within a run. UUID recommended", + "type": "string", + "minLength": 1 + }, + "name": { + "description": "Name or title of the test case", + "type": "string", + "minLength": 1 + }, + "status": { + "description": "Final outcome of the test case", + "enum": [ "passed", "failed", "skipped", "pending", "other" ] + }, + "duration": { + "description": "Test execution time (milliseconds)", + "type": "integer" + }, + "start": { + "description": "Test start time (milliseconds since Unix epoch)", + "type": "integer" + }, + "stop": { + "description": "Test end time (milliseconds since Unix epoch)", + "type": "integer" + }, + "suite": { + "description": "Suite hierarchy from top-level to immediate parent", + "type": "array", + "minItems": 1, + "items": { + "type": "string" + } + }, + "message": { + "description": "Error or failure message", + "type": "string" + }, + "trace": { + "description": "Stack trace or failure trace information", + "type": "string" + }, + "snippet": { + "description": "Code snippet associated with the failure", + "type": "string" + }, + "ai": { + "description": "AI-generated diagnostic data or suggestions", + "type": "string" + }, + "line": { + "description": "Line number of the test definition", + "type": "integer" + }, + "rawStatus": { + "description": "Original status from source tool before normalization", + "type": "string" + }, + "tags": { + "description": "Simple, keyless classifications used to categorize the test case", + "type": "array", + "items": { + "type": "string" + } + }, + "labels": { + "description": "Structured key-value metadata describing the test case. Values may be scalar primitives or non-empty arrays of primitive values", + "type": "object", + "additionalProperties": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "boolean" + }, + { + "type": "array", + "minItems": 1, + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "boolean" + } + ] + } + } + ] + } + }, + "type": { + "description": "Test classification (e.g., 'unit', 'integration', 'e2e')", + "type": "string" + }, + "filePath": { + "description": "Path to the file defining this test", + "type": "string" + }, + "retries": { + "description": "Number of retry attempts performed", + "type": "integer" + }, + "retryAttempts": { + "description": "List of retry attempts for this test", + "type": "array", + "items": { + "description": "Single retry attempt result", + "type": "object", + "required": [ "attempt", "status" ], + "properties": { + "attempt": { + "description": "Attempt number (1 = first execution)", + "type": "integer", + "minimum": 1 + }, + "attemptId": { + "description": "Unique identifier for this individual retry attempt. UUID recommended", + "type": "string", + "minLength": 1 + }, + "status": { + "description": "Outcome of this attempt", + "enum": [ + "passed", + "failed", + "skipped", + "pending", + "other" + ] + }, + "duration": { + "description": "Attempt execution time (milliseconds)", + "type": "integer" + }, + "message": { + "description": "Error or failure message for this attempt", + "type": "string" + }, + "trace": { + "description": "Stack trace for this attempt", + "type": "string" + }, + "line": { + "description": "Line number associated with failure", + "type": "integer" + }, + "snippet": { + "description": "Code snippet for this attempt", + "type": "string" + }, + "stdout": { + "description": "Standard output lines from this attempt", + "type": "array", + "items": { + "type": "string" + } + }, + "stderr": { + "description": "Standard error lines from this attempt", + "type": "array", + "items": { + "type": "string" + } + }, + "start": { + "description": "Attempt start time (milliseconds since Unix epoch)", + "type": "integer" + }, + "stop": { + "description": "Attempt end time (milliseconds since Unix epoch)", + "type": "integer" + }, + "attachments": { + "description": "Artifacts from this attempt", + "type": "array", + "items": { + "description": "External file or resource reference", + "type": "object", + "required": [ "name", "contentType", "path" ], + "properties": { + "attachmentId": { + "description": "Unique identifier for this attachment reference instance. UUID recommended", + "type": "string", + "minLength": 1 + }, + "name": { + "description": "Display name of the attachment", + "type": "string" + }, + "contentType": { + "description": "MIME type of the attachment", + "type": "string" + }, + "path": { + "description": "Path or URI to the attachment", + "type": "string" + }, + "extra": { + "description": "Extension point for arbitrary metadata", + "type": "object" + } + }, + "additionalProperties": false + } + }, + "extra": { + "description": "Extension point for arbitrary metadata", + "type": "object" + } + }, + "additionalProperties": false + } + }, + "flaky": { + "description": "True if test passed after one or more failed attempts", + "type": "boolean" + }, + "stdout": { + "description": "Standard output lines from test execution", + "type": "array", + "items": { + "type": "string" + } + }, + "stderr": { + "description": "Standard error lines from test execution", + "type": "array", + "items": { + "type": "string" + } + }, + "threadId": { + "description": "Thread or worker identifier", + "type": "string" + }, + "browser": { + "description": "Browser used for browser-based tests", + "type": "string" + }, + "device": { + "description": "Device or device profile used", + "type": "string" + }, + "screenshot": { + "description": "Single base64-encoded screenshot image", + "type": "string" + }, + "attachments": { + "description": "Additional artifacts (screenshots, logs, videos, etc.)", + "type": "array", + "items": { + "description": "External file or resource reference", + "type": "object", + "required": [ "name", "contentType", "path" ], + "properties": { + "attachmentId": { + "description": "Unique identifier for this attachment reference instance. UUID recommended", + "type": "string", + "minLength": 1 + }, + "name": { + "description": "Display name of the attachment", + "type": "string" + }, + "contentType": { + "description": "MIME type of the attachment", + "type": "string" + }, + "path": { + "description": "Path or URI to the attachment", + "type": "string" + }, + "extra": { + "description": "Extension point for arbitrary metadata", + "type": "object" + } + }, + "additionalProperties": false + } + }, + "parameters": { + "description": "Test parameters or input values", + "type": "object" + }, + "steps": { + "description": "Test steps or sub-operations", + "type": "array", + "items": { + "description": "Individual test step", + "type": "object", + "required": [ "name", "status" ], + "properties": { + "name": { + "description": "Name of the step", + "type": "string" + }, + "status": { + "description": "Outcome of the step", + "enum": [ + "passed", + "failed", + "skipped", + "pending", + "other" + ] + }, + "extra": { + "description": "Extension point for arbitrary metadata", + "type": "object" + } + }, + "additionalProperties": false + } + }, + "insights": { + "description": "Derived metrics for this test across runs", + "type": "object", + "properties": { + "passRate": { + "description": "Pass rate metric with baseline comparison", + "$ref": "#/definitions/metricDelta" + }, + "failRate": { + "description": "Fail rate metric with baseline comparison", + "$ref": "#/definitions/metricDelta" + }, + "flakyRate": { + "description": "Flaky rate metric with baseline comparison", + "$ref": "#/definitions/metricDelta" + }, + "averageTestDuration": { + "description": "Average duration metric with baseline comparison", + "$ref": "#/definitions/metricDelta" + }, + "p95TestDuration": { + "description": "95th percentile duration with baseline comparison", + "$ref": "#/definitions/metricDelta" + }, + "executedInRuns": { + "description": "Number of runs this test was executed in", + "type": "integer" + }, + "extra": { + "description": "Extension point for arbitrary metadata", + "type": "object" + } + }, + "additionalProperties": false + }, + "extra": { + "description": "Extension point for arbitrary metadata", + "type": "object" + } + }, + "additionalProperties": false + } + }, + "environment": { + "description": "Execution environment, system configuration, and build context", + "type": "object", + "properties": { + "reportName": { + "description": "Human-readable name for this report", + "type": "string" + }, + "appName": { + "description": "Name of the application under test", + "type": "string" + }, + "appVersion": { + "description": "Version of the application under test", + "type": "string" + }, + "buildId": { + "description": "Unique identifier for the CI/CD build", + "type": "string" + }, + "buildName": { + "description": "Name of the CI/CD build or pipeline", + "type": "string" + }, + "buildNumber": { + "description": "Sequential build number", + "type": "integer" + }, + "buildUrl": { + "description": "URL to the CI/CD build", + "type": "string" + }, + "repositoryName": { + "description": "Name of the source code repository", + "type": "string" + }, + "repositoryUrl": { + "description": "URL of the source code repository", + "type": "string" + }, + "commit": { + "description": "Git commit SHA or VCS revision identifier", + "type": "string" + }, + "branchName": { + "description": "Git branch or VCS branch name", + "type": "string" + }, + "osPlatform": { + "description": "Operating system platform (e.g., 'linux', 'darwin', 'win32')", + "type": "string" + }, + "osRelease": { + "description": "Operating system release version", + "type": "string" + }, + "osVersion": { + "description": "Operating system version string", + "type": "string" + }, + "testEnvironment": { + "description": "Logical test environment (e.g., 'staging', 'production')", + "type": "string" + }, + "shardId": { + "description": "Shard or partition label identifying which part of a distributed run produced this document", + "type": "string", + "minLength": 1 + }, + "healthy": { + "description": "Indicates if the run is considered healthy", + "type": "boolean" + }, + "extra": { + "description": "Extension point for arbitrary metadata", + "type": "object" + } + }, + "additionalProperties": false + }, + "extra": { + "description": "Extension point for arbitrary metadata", + "type": "object" + } + }, + "additionalProperties": false + }, + "insights": { + "description": "Aggregated metrics computed across multiple test runs", + "type": "object", + "properties": { + "passRate": { + "description": "Overall pass rate with baseline comparison", + "$ref": "#/definitions/metricDelta" + }, + "failRate": { + "description": "Overall fail rate with baseline comparison", + "$ref": "#/definitions/metricDelta" + }, + "flakyRate": { + "description": "Overall flaky rate with baseline comparison", + "$ref": "#/definitions/metricDelta" + }, + "averageRunDuration": { + "description": "Average run duration with baseline comparison", + "$ref": "#/definitions/metricDelta" + }, + "p95RunDuration": { + "description": "95th percentile run duration with baseline comparison", + "$ref": "#/definitions/metricDelta" + }, + "averageTestDuration": { + "description": "Average test duration with baseline comparison", + "$ref": "#/definitions/metricDelta" + }, + "runsAnalyzed": { + "description": "Number of historical runs analyzed for insights", + "type": "integer" + }, + "extra": { + "description": "Extension point for arbitrary metadata", + "type": "object" + } + }, + "additionalProperties": false + }, + "baseline": { + "description": "Reference to a previous report used for comparison", + "type": "object", + "required": [ "reportId" ], + "properties": { + "reportId": { + "description": "UUID of the baseline report", + "type": "string", + "format": "uuid", + "minLength": 1 + }, + "timestamp": { + "description": "Generation time of the baseline report", + "type": "string", + "format": "date-time" + }, + "source": { + "description": "Origin or location of the baseline report", + "type": "string" + }, + "buildNumber": { + "description": "Build number of the baseline run", + "type": "integer" + }, + "buildName": { + "description": "Build name of the baseline run", + "type": "string" + }, + "buildUrl": { + "description": "URL to the baseline build", + "type": "string", + "format": "uri" + }, + "commit": { + "description": "Git commit SHA of the baseline run", + "type": "string" + }, + "extra": { + "description": "Extension point for arbitrary metadata", + "type": "object" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false, + "definitions": { + "metricDelta": { + "description": "Metric value with baseline comparison", + "type": "object", + "properties": { + "current": { + "description": "Current metric value", + "type": "number" + }, + "baseline": { + "description": "Baseline metric value for comparison", + "type": "number" + }, + "change": { + "description": "Computed difference between current and baseline", + "type": "number" + } + }, + "additionalProperties": false + } + } +} diff --git a/src/ctrf-schema-0.0.json b/src/ctrf-schema-0.0.4.json similarity index 100% rename from src/ctrf-schema-0.0.json rename to src/ctrf-schema-0.0.4.json diff --git a/src/ctrf-schema-0.1.0.json b/src/ctrf-schema-0.1.0.json new file mode 100644 index 0000000..85bd935 --- /dev/null +++ b/src/ctrf-schema-0.1.0.json @@ -0,0 +1,713 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "CTRF JSON Schema", + "description": "Common Test Report Format - an open standard JSON format for test results reports", + "type": "object", + "required": [ "results", "reportFormat", "specVersion" ], + "properties": { + "reportFormat": { + "description": "Document format identifier. Must be 'CTRF'", + "const": "CTRF" + }, + "specVersion": { + "description": "CTRF specification version in SemVer format (MAJOR.MINOR.PATCH)", + "type": "string", + "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$" + }, + "reportId": { + "description": "Unique identifier for this CTRF document instance (UUID). Identifies the serialized artifact", + "type": "string", + "format": "uuid", + "minLength": 1 + }, + "runId": { + "description": "Identifier for the logical test run. Shared across shards/documents belonging to the same run", + "type": "string", + "minLength": 1 + }, + "timestamp": { + "description": "Report generation time (RFC 3339 / ISO 8601)", + "type": "string", + "format": "date-time" + }, + "generatedBy": { + "description": "Tool or system that produced this CTRF document", + "type": "string" + }, + "extra": { + "description": "Extension point for arbitrary metadata", + "type": "object" + }, + "results": { + "description": "Results of a single test execution run", + "type": "object", + "required": [ "tool", "summary", "tests" ], + "properties": { + "tool": { + "description": "Tool or framework that produced the test results", + "type": "object", + "required": [ "name" ], + "properties": { + "name": { + "description": "Name of the testing tool or framework", + "type": "string", + "minLength": 1 + }, + "version": { + "description": "Version of the testing tool", + "type": "string" + }, + "extra": { + "description": "Extension point for arbitrary metadata", + "type": "object" + } + }, + "additionalProperties": false + }, + "summary": { + "description": "Aggregated statistics and timing for the test run", + "type": "object", + "required": [ + "tests", + "passed", + "failed", + "skipped", + "pending", + "other", + "start", + "stop" + ], + "properties": { + "tests": { + "description": "Total number of tests executed", + "type": "integer" + }, + "passed": { + "description": "Count of tests with status 'passed'", + "type": "integer" + }, + "failed": { + "description": "Count of tests with status 'failed'", + "type": "integer" + }, + "skipped": { + "description": "Count of tests with status 'skipped'", + "type": "integer" + }, + "pending": { + "description": "Count of tests with status 'pending'", + "type": "integer" + }, + "other": { + "description": "Count of tests with status 'other'", + "type": "integer" + }, + "flaky": { + "description": "Count of flaky tests (passed after failed attempts)", + "type": "integer" + }, + "suites": { + "description": "Number of test suites in the run", + "type": "integer" + }, + "start": { + "description": "Run start time (milliseconds since Unix epoch)", + "type": "integer" + }, + "stop": { + "description": "Run end time (milliseconds since Unix epoch)", + "type": "integer" + }, + "duration": { + "description": "Total run duration (milliseconds)", + "type": "integer" + }, + "extra": { + "description": "Extension point for arbitrary metadata", + "type": "object" + } + }, + "additionalProperties": false + }, + "tests": { + "description": "List of test cases executed during the run", + "type": "array", + "items": { + "description": "Individual test case result", + "type": "object", + "required": [ "name", "status", "duration" ], + "properties": { + "id": { + "description": "Legacy identifier for the test case (UUID). New producers should prefer testId", + "type": "string", + "format": "uuid", + "minLength": 1 + }, + "testId": { + "description": "Stable identifier for the logical test case. Should be derived from stable test attributes when generated by a producer", + "type": "string", + "minLength": 1 + }, + "executionId": { + "description": "Unique identifier for this specific execution of the test case within a run. UUID recommended", + "type": "string", + "minLength": 1 + }, + "name": { + "description": "Name or title of the test case", + "type": "string", + "minLength": 1 + }, + "status": { + "description": "Final outcome of the test case", + "enum": [ "passed", "failed", "skipped", "pending", "other" ] + }, + "duration": { + "description": "Test execution time (milliseconds)", + "type": "integer" + }, + "start": { + "description": "Test start time (milliseconds since Unix epoch)", + "type": "integer" + }, + "stop": { + "description": "Test end time (milliseconds since Unix epoch)", + "type": "integer" + }, + "suite": { + "description": "Suite hierarchy from top-level to immediate parent", + "type": "array", + "minItems": 1, + "items": { + "type": "string" + } + }, + "message": { + "description": "Error or failure message", + "type": "string" + }, + "trace": { + "description": "Stack trace or failure trace information", + "type": "string" + }, + "snippet": { + "description": "Code snippet associated with the failure", + "type": "string" + }, + "ai": { + "description": "AI-generated diagnostic data or suggestions", + "type": "string" + }, + "line": { + "description": "Line number of the test definition", + "type": "integer" + }, + "rawStatus": { + "description": "Original status from source tool before normalization", + "type": "string" + }, + "tags": { + "description": "Simple, keyless classifications used to categorize the test case", + "type": "array", + "items": { + "type": "string" + } + }, + "labels": { + "description": "Structured key-value metadata describing the test case. Values may be scalar primitives or non-empty arrays of primitive values", + "type": "object", + "additionalProperties": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "boolean" + }, + { + "type": "array", + "minItems": 1, + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "boolean" + } + ] + } + } + ] + } + }, + "type": { + "description": "Test classification (e.g., 'unit', 'integration', 'e2e')", + "type": "string" + }, + "filePath": { + "description": "Path to the file defining this test", + "type": "string" + }, + "retries": { + "description": "Number of times the test was re-executed after its initial attempt", + "type": "integer", + "minimum": 0 + }, + "retryAttempts": { + "description": "Ordered history of attempts completed before the final attempt represented by the test object", + "type": "array", + "minItems": 1, + "items": { + "description": "Attempt completed before the final attempt", + "type": "object", + "required": [ "attempt", "status" ], + "properties": { + "attempt": { + "description": "Original sequence number for this attempt (1 = initial execution)", + "type": "integer", + "minimum": 1 + }, + "attemptId": { + "description": "Unique identifier for this individual attempt. UUID recommended", + "type": "string", + "minLength": 1 + }, + "status": { + "description": "Outcome of this attempt", + "enum": [ + "passed", + "failed", + "skipped", + "pending", + "other" + ] + }, + "duration": { + "description": "Attempt execution time (milliseconds)", + "type": "integer", + "minimum": 0 + }, + "message": { + "description": "Error or failure message for this attempt", + "type": "string" + }, + "trace": { + "description": "Stack trace for this attempt", + "type": "string" + }, + "line": { + "description": "Line number associated with failure", + "type": "integer" + }, + "snippet": { + "description": "Code snippet for this attempt", + "type": "string" + }, + "stdout": { + "description": "Standard output lines from this attempt", + "type": "array", + "items": { + "type": "string" + } + }, + "stderr": { + "description": "Standard error lines from this attempt", + "type": "array", + "items": { + "type": "string" + } + }, + "start": { + "description": "Attempt start time (milliseconds since Unix epoch)", + "type": "integer" + }, + "stop": { + "description": "Attempt end time (milliseconds since Unix epoch)", + "type": "integer" + }, + "attachments": { + "description": "Artifacts from this attempt", + "type": "array", + "items": { + "description": "External file or resource reference", + "type": "object", + "required": [ "name", "contentType", "path" ], + "properties": { + "attachmentId": { + "description": "Unique identifier for this attachment reference instance. UUID recommended", + "type": "string", + "minLength": 1 + }, + "name": { + "description": "Display name of the attachment", + "type": "string" + }, + "contentType": { + "description": "MIME type of the attachment", + "type": "string" + }, + "path": { + "description": "Path or URI to the attachment", + "type": "string" + }, + "extra": { + "description": "Extension point for arbitrary metadata", + "type": "object" + } + }, + "additionalProperties": false + } + }, + "extra": { + "description": "Extension point for arbitrary metadata", + "type": "object" + } + }, + "additionalProperties": false + } + }, + "flaky": { + "description": "True if test passed after one or more failed attempts", + "type": "boolean" + }, + "stdout": { + "description": "Standard output lines from test execution", + "type": "array", + "items": { + "type": "string" + } + }, + "stderr": { + "description": "Standard error lines from test execution", + "type": "array", + "items": { + "type": "string" + } + }, + "threadId": { + "description": "Thread or worker identifier", + "type": "string" + }, + "browser": { + "description": "Browser used for browser-based tests", + "type": "string" + }, + "device": { + "description": "Device or device profile used", + "type": "string" + }, + "screenshot": { + "description": "Single base64-encoded screenshot image", + "type": "string" + }, + "attachments": { + "description": "Additional artifacts (screenshots, logs, videos, etc.)", + "type": "array", + "items": { + "description": "External file or resource reference", + "type": "object", + "required": [ "name", "contentType", "path" ], + "properties": { + "attachmentId": { + "description": "Unique identifier for this attachment reference instance. UUID recommended", + "type": "string", + "minLength": 1 + }, + "name": { + "description": "Display name of the attachment", + "type": "string" + }, + "contentType": { + "description": "MIME type of the attachment", + "type": "string" + }, + "path": { + "description": "Path or URI to the attachment", + "type": "string" + }, + "extra": { + "description": "Extension point for arbitrary metadata", + "type": "object" + } + }, + "additionalProperties": false + } + }, + "parameters": { + "description": "Test parameters or input values", + "type": "object" + }, + "steps": { + "description": "Test steps or sub-operations", + "type": "array", + "items": { + "description": "Individual test step", + "type": "object", + "required": [ "name", "status" ], + "properties": { + "name": { + "description": "Name of the step", + "type": "string" + }, + "status": { + "description": "Outcome of the step", + "enum": [ + "passed", + "failed", + "skipped", + "pending", + "other" + ] + }, + "extra": { + "description": "Extension point for arbitrary metadata", + "type": "object" + } + }, + "additionalProperties": false + } + }, + "insights": { + "description": "Derived metrics for this test across runs", + "type": "object", + "properties": { + "passRate": { + "description": "Pass rate metric with baseline comparison", + "$ref": "#/definitions/metricDelta" + }, + "failRate": { + "description": "Fail rate metric with baseline comparison", + "$ref": "#/definitions/metricDelta" + }, + "flakyRate": { + "description": "Flaky rate metric with baseline comparison", + "$ref": "#/definitions/metricDelta" + }, + "averageTestDuration": { + "description": "Average duration metric with baseline comparison", + "$ref": "#/definitions/metricDelta" + }, + "p95TestDuration": { + "description": "95th percentile duration with baseline comparison", + "$ref": "#/definitions/metricDelta" + }, + "executedInRuns": { + "description": "Number of runs this test was executed in", + "type": "integer" + }, + "extra": { + "description": "Extension point for arbitrary metadata", + "type": "object" + } + }, + "additionalProperties": false + }, + "extra": { + "description": "Extension point for arbitrary metadata", + "type": "object" + } + }, + "additionalProperties": false + } + }, + "environment": { + "description": "Execution environment, system configuration, and build context", + "type": "object", + "properties": { + "reportName": { + "description": "Human-readable name for this report", + "type": "string" + }, + "appName": { + "description": "Name of the application under test", + "type": "string" + }, + "appVersion": { + "description": "Version of the application under test", + "type": "string" + }, + "buildId": { + "description": "Unique identifier for the CI/CD build", + "type": "string" + }, + "buildName": { + "description": "Name of the CI/CD build or pipeline", + "type": "string" + }, + "buildNumber": { + "description": "Sequential build number", + "type": "integer" + }, + "buildUrl": { + "description": "URL to the CI/CD build", + "type": "string" + }, + "repositoryName": { + "description": "Name of the source code repository", + "type": "string" + }, + "repositoryUrl": { + "description": "URL of the source code repository", + "type": "string" + }, + "commit": { + "description": "Git commit SHA or VCS revision identifier", + "type": "string" + }, + "branchName": { + "description": "Git branch or VCS branch name", + "type": "string" + }, + "osPlatform": { + "description": "Operating system platform (e.g., 'linux', 'darwin', 'win32')", + "type": "string" + }, + "osRelease": { + "description": "Operating system release version", + "type": "string" + }, + "osVersion": { + "description": "Operating system version string", + "type": "string" + }, + "testEnvironment": { + "description": "Logical test environment (e.g., 'staging', 'production')", + "type": "string" + }, + "shardId": { + "description": "Shard or partition label identifying which part of a distributed run produced this document", + "type": "string", + "minLength": 1 + }, + "healthy": { + "description": "Indicates if the run is considered healthy", + "type": "boolean" + }, + "extra": { + "description": "Extension point for arbitrary metadata", + "type": "object" + } + }, + "additionalProperties": false + }, + "extra": { + "description": "Extension point for arbitrary metadata", + "type": "object" + } + }, + "additionalProperties": false + }, + "insights": { + "description": "Aggregated metrics computed across multiple test runs", + "type": "object", + "properties": { + "passRate": { + "description": "Overall pass rate with baseline comparison", + "$ref": "#/definitions/metricDelta" + }, + "failRate": { + "description": "Overall fail rate with baseline comparison", + "$ref": "#/definitions/metricDelta" + }, + "flakyRate": { + "description": "Overall flaky rate with baseline comparison", + "$ref": "#/definitions/metricDelta" + }, + "averageRunDuration": { + "description": "Average run duration with baseline comparison", + "$ref": "#/definitions/metricDelta" + }, + "p95RunDuration": { + "description": "95th percentile run duration with baseline comparison", + "$ref": "#/definitions/metricDelta" + }, + "averageTestDuration": { + "description": "Average test duration with baseline comparison", + "$ref": "#/definitions/metricDelta" + }, + "runsAnalyzed": { + "description": "Number of historical runs analyzed for insights", + "type": "integer" + }, + "extra": { + "description": "Extension point for arbitrary metadata", + "type": "object" + } + }, + "additionalProperties": false + }, + "baseline": { + "description": "Reference to a previous report used for comparison", + "type": "object", + "required": [ "reportId" ], + "properties": { + "reportId": { + "description": "UUID of the baseline report", + "type": "string", + "format": "uuid", + "minLength": 1 + }, + "timestamp": { + "description": "Generation time of the baseline report", + "type": "string", + "format": "date-time" + }, + "source": { + "description": "Origin or location of the baseline report", + "type": "string" + }, + "buildNumber": { + "description": "Build number of the baseline run", + "type": "integer" + }, + "buildName": { + "description": "Build name of the baseline run", + "type": "string" + }, + "buildUrl": { + "description": "URL to the baseline build", + "type": "string", + "format": "uri" + }, + "commit": { + "description": "Git commit SHA of the baseline run", + "type": "string" + }, + "extra": { + "description": "Extension point for arbitrary metadata", + "type": "object" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false, + "definitions": { + "metricDelta": { + "description": "Metric value with baseline comparison", + "type": "object", + "properties": { + "current": { + "description": "Current metric value", + "type": "number" + }, + "baseline": { + "description": "Baseline metric value for comparison", + "type": "number" + }, + "change": { + "description": "Computed difference between current and baseline", + "type": "number" + } + }, + "additionalProperties": false + } + } +} diff --git a/src/index.ts b/src/index.ts index c2f0a1d..be306e6 100644 --- a/src/index.ts +++ b/src/index.ts @@ -37,6 +37,8 @@ export type { ValidateOptions, } from "./types.js"; +export type { SchemaSelector, SupportedSpecVersion } from "./constants.js"; + export { REPORT_FORMAT, CURRENT_SPEC_VERSION, diff --git a/src/schema.test.ts b/src/schema.test.ts index 2323620..fd73299 100644 --- a/src/schema.test.ts +++ b/src/schema.test.ts @@ -29,20 +29,28 @@ describe("schema", () => { }); describe("getSchema", () => { - it("should return schema for supported version", () => { - const result = getSchema(CURRENT_SPEC_VERSION); + it.each(SUPPORTED_SPEC_VERSIONS)( + "should return the schema for %s", + (version) => { + const result = getSchema(version); - expect(result).toBeDefined(); - expect(typeof result).toBe("object"); + expect(result).toBeDefined(); + expect(typeof result).toBe("object"); + }, + ); + + it("should resolve latest to the current schema", () => { + expect(getSchema("latest")).toBe(getSchema(CURRENT_SPEC_VERSION)); + expect(getSchema("latest")).toBe(schema); }); it("should throw SchemaVersionError for unsupported version", () => { - expect(() => getSchema("99.0.0")).toThrow(SchemaVersionError); + expect(() => getSchema("99.0.0" as never)).toThrow(SchemaVersionError); }); it("should include supported versions in error", () => { try { - getSchema("99.0.0"); + getSchema("99.0.0" as never); expect.fail("Should have thrown"); } catch (error) { expect(error).toBeInstanceOf(SchemaVersionError); diff --git a/src/schema.ts b/src/schema.ts index 6c87f6e..c678104 100644 --- a/src/schema.ts +++ b/src/schema.ts @@ -5,7 +5,12 @@ import fs from "node:fs"; import path from "node:path"; import { fileURLToPath } from "node:url"; -import { CURRENT_SPEC_VERSION, SUPPORTED_SPEC_VERSIONS } from "./constants.js"; +import { + CURRENT_SPEC_VERSION, + SUPPORTED_SPEC_VERSIONS, + type SchemaSelector, + type SupportedSpecVersion, +} from "./constants.js"; import { SchemaVersionError } from "./errors.js"; const __filename = fileURLToPath(import.meta.url); @@ -15,29 +20,37 @@ const _schemas = new Map(); /** * Load a schema file for a specific version. - * Files should be named: ctrf-schema-{major}.{minor}.json + * Files are named: ctrf-schema-{major}.{minor}.{patch}.json */ -function loadSchemaForVersion(version: string): object { - const versionParts = version.split("."); - if (versionParts.length < 2) { - throw new SchemaVersionError(version, [...SUPPORTED_SPEC_VERSIONS]); - } - const majorMinor = `${versionParts[0]}.${versionParts[1]}`; - - if (_schemas.has(majorMinor)) { - return _schemas.get(majorMinor) as object; +function loadSchemaForVersion(version: SupportedSpecVersion): object { + if (_schemas.has(version)) { + return _schemas.get(version) as object; } - const schemaPath = path.resolve(__dirname, `ctrf-schema-${majorMinor}.json`); + const schemaPath = path.resolve(__dirname, `ctrf-schema-${version}.json`); if (!fs.existsSync(schemaPath)) { throw new SchemaVersionError(version, [...SUPPORTED_SPEC_VERSIONS]); } const schema = JSON.parse(fs.readFileSync(schemaPath, "utf8")) as object; - _schemas.set(majorMinor, schema); + _schemas.set(version, schema); return schema; } +function resolveSchemaSelector(selector: SchemaSelector): SupportedSpecVersion { + if (selector === "latest") return CURRENT_SPEC_VERSION; + + if ( + !SUPPORTED_SPEC_VERSIONS.includes( + selector as (typeof SUPPORTED_SPEC_VERSIONS)[number], + ) + ) { + throw new SchemaVersionError(selector, [...SUPPORTED_SPEC_VERSIONS]); + } + + return selector; +} + /** * * @group Schema & Versioning @@ -56,26 +69,18 @@ export const schema: object = loadSchemaForVersion(CURRENT_SPEC_VERSION); * @group Schema & Versioning * Get the JSON Schema for a specific CTRF spec version. * - * @param version - The spec version (MAJOR.MINOR.PATCH) to get the schema for + * @param version - A supported spec version or `latest` * @returns The JSON Schema object for that version * @throws SchemaVersionError if the version is not supported * * @example * ```typescript - * const v0_0Schema = getSchema('0.0.0'); - * const v1_0Schema = getSchema('1.0.0'); + * const historicalSchema = getSchema('0.0.2'); + * const latestSchema = getSchema('latest'); * ``` */ -export function getSchema(version: string): object { - if ( - !SUPPORTED_SPEC_VERSIONS.includes( - version as (typeof SUPPORTED_SPEC_VERSIONS)[number], - ) - ) { - throw new SchemaVersionError(version, [...SUPPORTED_SPEC_VERSIONS]); - } - - return loadSchemaForVersion(version); +export function getSchema(version: SchemaSelector): object { + return loadSchemaForVersion(resolveSchemaSelector(version)); } /** diff --git a/src/types.ts b/src/types.ts index 72ae0d4..9c7ff9f 100644 --- a/src/types.ts +++ b/src/types.ts @@ -3,6 +3,8 @@ * Generated from the CTRF JSON Schema specification */ +import type { SchemaSelector } from "./constants.js"; + // ============================================================================ // Core Types // ============================================================================ @@ -544,6 +546,6 @@ export interface StringifyOptions { * @group Validation Options */ export interface ValidateOptions { - /** Specific spec version to validate against */ - specVersion?: string; + /** Specific spec version to validate against, or `latest` (default) */ + specVersion?: SchemaSelector; } diff --git a/src/validate.test.ts b/src/validate.test.ts index e263a02..cbdd76c 100644 --- a/src/validate.test.ts +++ b/src/validate.test.ts @@ -12,11 +12,12 @@ import { } from "./validate.js"; import { ValidationError } from "./errors.js"; import type { CTRFReport } from "./types.js"; +import { CURRENT_SPEC_VERSION } from "./constants.js"; describe("validate", () => { const validReport: CTRFReport = { reportFormat: "CTRF", - specVersion: "1.0.0", + specVersion: CURRENT_SPEC_VERSION, results: { tool: { name: "jest" }, summary: { @@ -50,7 +51,7 @@ describe("validate", () => { it("should return errors for invalid report", () => { const invalid = { reportFormat: "INVALID", - specVersion: "1.0.0", + specVersion: CURRENT_SPEC_VERSION, results: {}, }; @@ -63,7 +64,7 @@ describe("validate", () => { it("should validate missing required fields", () => { const missing = { reportFormat: "CTRF", - specVersion: "1.0.0", + specVersion: CURRENT_SPEC_VERSION, }; const result = validate(missing); @@ -112,6 +113,95 @@ describe("validate", () => { expect(validate(report).valid).toBe(true); }); + it("should apply the selected historical schema", () => { + const report = { + ...validReport, + results: { + ...validReport.results, + tests: [ + { + name: "test", + status: "passed", + duration: 100, + labels: { priority: "high" }, + }, + ], + }, + }; + + expect(validate(report, { specVersion: "0.0.1" }).valid).toBe(false); + expect(validate(report, { specVersion: "0.0.2" }).valid).toBe(true); + }); + + it("should distinguish scalar and multi-value label releases", () => { + const report = { + ...validReport, + results: { + ...validReport.results, + tests: [ + { + name: "test", + status: "passed", + duration: 100, + labels: { owners: ["qa", "platform"] }, + }, + ], + }, + }; + + expect(validate(report, { specVersion: "0.0.2" }).valid).toBe(false); + expect(validate(report, { specVersion: "0.0.3" }).valid).toBe(true); + }); + + it("should add identity fields in 0.0.3", () => { + const report = { ...validReport, runId: "run-1" }; + + expect(validate(report, { specVersion: "0.0.2" }).valid).toBe(false); + expect(validate(report, { specVersion: "0.0.3" }).valid).toBe(true); + }); + + it("should apply clarified retry semantics from 0.0.4 onward", () => { + const report = { + ...validReport, + results: { + ...validReport.results, + tests: [ + { + name: "test", + status: "passed", + duration: 100, + retryAttempts: [{ attempt: 2, status: "failed" }], + }, + ], + }, + }; + + expect(validate(report, { specVersion: "0.0.3" }).valid).toBe(true); + expect(validate(report, { specVersion: "0.0.4" }).valid).toBe(false); + expect(validate(report, { specVersion: "0.1.0" }).valid).toBe(false); + }); + + it("should treat latest as 0.1.0", () => { + const invalidLatestReport = { + ...validReport, + results: { + ...validReport.results, + tests: [ + { + name: "test", + status: "passed", + duration: 100, + retries: 1, + }, + ], + }, + }; + + expect(validate(invalidLatestReport, { specVersion: "latest" })).toEqual( + validate(invalidLatestReport, { specVersion: "0.1.0" }), + ); + }); + it("should reject empty label arrays", () => { const report = { ...validReport, @@ -385,6 +475,26 @@ describe("validate", () => { it("should return false for undefined", () => { expect(isValid(undefined)).toBe(false); }); + + it("should honor the selected schema version", () => { + const report = { + ...validReport, + results: { + ...validReport.results, + tests: [ + { + name: "test", + status: "passed", + duration: 100, + labels: { priority: "high" }, + }, + ], + }, + }; + + expect(isValid(report, { specVersion: "0.0.1" })).toBe(false); + expect(isValid(report, { specVersion: "0.0.2" })).toBe(true); + }); }); describe("validateStrict", () => { @@ -424,6 +534,30 @@ describe("validate", () => { expect((error as ValidationError).errors.length).toBeGreaterThan(0); } }); + + it("should honor the selected schema version", () => { + const report = { + ...validReport, + results: { + ...validReport.results, + tests: [ + { + name: "test", + status: "passed", + duration: 100, + labels: { priority: "high" }, + }, + ], + }, + }; + + expect(() => validateStrict(report, { specVersion: "0.0.1" })).toThrow( + ValidationError, + ); + expect(() => + validateStrict(report, { specVersion: "0.0.2" }), + ).not.toThrow(); + }); }); describe("isCTRFReport", () => { diff --git a/src/validate.ts b/src/validate.ts index 31b7940..9a7cb19 100644 --- a/src/validate.ts +++ b/src/validate.ts @@ -13,11 +13,24 @@ import type { ValidationErrorDetail, ValidateOptions, } from "./types.js"; -import { REPORT_FORMAT, TEST_STATUSES } from "./constants.js"; +import { + CURRENT_SPEC_VERSION, + REPORT_FORMAT, + TEST_STATUSES, + type SupportedSpecVersion, +} from "./constants.js"; -function validateRetryHistories(report: CTRFReport): ValidationErrorDetail[] { +function validateRetryHistories( + report: CTRFReport, + version: SupportedSpecVersion, +): ValidationErrorDetail[] { const errors: ValidationErrorDetail[] = []; + // Versions before 0.0.4 used the earlier retry model. In those versions, + // matching history length was recommended rather than required, and the + // presence and ordering constraints below were not normative requirements. + if (version !== "0.0.4" && version !== "0.1.0") return errors; + for (const [testIndex, test] of report.results.tests.entries()) { const path = `/results/tests/${testIndex}`; const retries = test.retries; @@ -80,7 +93,7 @@ function validateRetryHistories(report: CTRFReport): ValidationErrorDetail[] { * * @group Core Operations * @param report - The object to validate - * @param options - Validation options (e.g., specific spec version) + * @param options - Validation options (e.g., a specific spec version or `latest`) * @returns Validation result containing `valid` boolean and `errors` array * * @example @@ -91,16 +104,20 @@ function validateRetryHistories(report: CTRFReport): ValidationErrorDetail[] { * } * * // Validate against specific version - * const result = validate(report, { specVersion: '1.0.0' }); + * const result = validate(report, { specVersion: '0.0.2' }); * ``` */ export function validate( report: unknown, options: ValidateOptions = {}, ): ValidationResult { - const ajv = new Ajv({ allErrors: true }); + const ajv = new Ajv({ allErrors: true, allowUnionTypes: true }); addFormats(ajv); + const selectedVersion = + !options.specVersion || options.specVersion === "latest" + ? CURRENT_SPEC_VERSION + : options.specVersion; const schemaToUse = options.specVersion ? getSchema(options.specVersion) : schema; @@ -116,7 +133,12 @@ export function validate( })) || []; if (valid) { - errors.push(...validateRetryHistories(report as CTRFReport)); + errors.push( + ...validateRetryHistories( + report as CTRFReport, + selectedVersion as SupportedSpecVersion, + ), + ); } return { valid: errors.length === 0, errors }; @@ -128,6 +150,7 @@ export function validate( * Check if a report is valid (type guard). * * @param report - The object to validate + * @param options - Validation options (e.g., a specific spec version or `latest`) * @returns true if the report is a valid CTRFReport * * @example @@ -138,8 +161,11 @@ export function validate( * } * ``` */ -export function isValid(report: unknown): report is CTRFReport { - const result = validate(report); +export function isValid( + report: unknown, + options: ValidateOptions = {}, +): report is CTRFReport { + const result = validate(report, options); return result.valid; } @@ -149,6 +175,7 @@ export function isValid(report: unknown): report is CTRFReport { * Validate a report and throw if invalid (assertion). * * @param report - The object to validate + * @param options - Validation options (e.g., a specific spec version or `latest`) * @throws ValidationError if the report is invalid * * @example @@ -163,8 +190,11 @@ export function isValid(report: unknown): report is CTRFReport { * } * ``` */ -export function validateStrict(report: unknown): asserts report is CTRFReport { - const result = validate(report); +export function validateStrict( + report: unknown, + options: ValidateOptions = {}, +): asserts report is CTRFReport { + const result = validate(report, options); if (!result.valid) { const errorMessages = result.errors