Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,16 @@ const testById = findTest(report, { id: 'test-uuid' })
```typescript
import { merge } from 'ctrf'

// Merge multiple reports into one
// Merge reports declaring the same specification version into one
const merged = merge([report1, report2, report3], {
deduplicateTests: true, // Remove duplicate tests by ID
})
```

Merging preserves the declared specification version and rejects mixed versions.
Convert and validate inputs explicitly before combining different versions. Global
errors are retained in input order, separately from test counts.

### ID Generation

```typescript
Expand Down Expand Up @@ -255,8 +259,8 @@ import {
} from 'ctrf'

REPORT_FORMAT // 'CTRF'
CURRENT_SPEC_VERSION // '0.2.0'
SUPPORTED_SPEC_VERSIONS // ['0.0.1', '0.0.2', '0.0.3', '0.0.4', '0.1.0', '0.2.0']
CURRENT_SPEC_VERSION // '0.3.0'
SUPPORTED_SPEC_VERSIONS // ['0.0.1', '0.0.2', '0.0.3', '0.0.4', '0.1.0', '0.2.0', '0.3.0']
TEST_STATUSES // ['passed', 'failed', 'skipped', 'pending', 'other']
CTRF_NAMESPACE // UUID namespace for deterministic IDs
```
Expand Down Expand Up @@ -296,6 +300,6 @@ const v0_0_2Schema = getSchema('0.0.2')
const latestSchema = getSchema('latest')

// Get version info
const version = getCurrentSpecVersion() // '0.2.0'
const supported = getSupportedSpecVersions() // ['0.0.1', '0.0.2', '0.0.3', '0.0.4', '0.1.0', '0.2.0']
const version = getCurrentSpecVersion() // '0.3.0'
const supported = getSupportedSpecVersions() // ['0.0.1', '0.0.2', '0.0.3', '0.0.4', '0.1.0', '0.2.0', '0.3.0']
```
52 changes: 36 additions & 16 deletions docs/classes/ReportBuilder.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# Class: ReportBuilder

Defined in: [builder.ts:50](https://github.com/ctrf-io/ctrf-js/blob/main/src/builder.ts#L50)
Defined in: [builder.ts:52](https://github.com/ctrf-io/ctrf-js/blob/main/src/builder.ts#L52)

## Example

Expand All @@ -31,7 +31,7 @@ const report = new ReportBuilder()

> **new ReportBuilder**(`options?`): `ReportBuilder`

Defined in: [builder.ts:64](https://github.com/ctrf-io/ctrf-js/blob/main/src/builder.ts#L64)
Defined in: [builder.ts:67](https://github.com/ctrf-io/ctrf-js/blob/main/src/builder.ts#L67)

#### Parameters

Expand All @@ -49,7 +49,7 @@ Defined in: [builder.ts:64](https://github.com/ctrf-io/ctrf-js/blob/main/src/bui

> **specVersion**(`version`): `this`

Defined in: [builder.ts:76](https://github.com/ctrf-io/ctrf-js/blob/main/src/builder.ts#L76)
Defined in: [builder.ts:79](https://github.com/ctrf-io/ctrf-js/blob/main/src/builder.ts#L79)

Set the spec version.

Expand All @@ -69,7 +69,7 @@ Set the spec version.

> **reportId**(`uuid?`): `this`

Defined in: [builder.ts:85](https://github.com/ctrf-io/ctrf-js/blob/main/src/builder.ts#L85)
Defined in: [builder.ts:88](https://github.com/ctrf-io/ctrf-js/blob/main/src/builder.ts#L88)

Set or generate the report ID.

Expand All @@ -91,7 +91,7 @@ UUID to use, or undefined to auto-generate

> **runId**(`id`): `this`

Defined in: [builder.ts:93](https://github.com/ctrf-io/ctrf-js/blob/main/src/builder.ts#L93)
Defined in: [builder.ts:96](https://github.com/ctrf-io/ctrf-js/blob/main/src/builder.ts#L96)

Set the logical test run ID shared across related CTRF documents.

Expand All @@ -111,7 +111,7 @@ Set the logical test run ID shared across related CTRF documents.

> **timestamp**(`date?`): `this`

Defined in: [builder.ts:102](https://github.com/ctrf-io/ctrf-js/blob/main/src/builder.ts#L102)
Defined in: [builder.ts:105](https://github.com/ctrf-io/ctrf-js/blob/main/src/builder.ts#L105)

Set the timestamp.

Expand All @@ -133,7 +133,7 @@ Date to use, or undefined for current time

> **generatedBy**(`name`): `this`

Defined in: [builder.ts:116](https://github.com/ctrf-io/ctrf-js/blob/main/src/builder.ts#L116)
Defined in: [builder.ts:119](https://github.com/ctrf-io/ctrf-js/blob/main/src/builder.ts#L119)

Set the generator name.

Expand All @@ -153,7 +153,7 @@ Set the generator name.

> **tool**(`tool`): `this`

Defined in: [builder.ts:124](https://github.com/ctrf-io/ctrf-js/blob/main/src/builder.ts#L124)
Defined in: [builder.ts:127](https://github.com/ctrf-io/ctrf-js/blob/main/src/builder.ts#L127)

Set the tool information.

Expand All @@ -173,7 +173,7 @@ Set the tool information.

> **environment**(`env`): `this`

Defined in: [builder.ts:132](https://github.com/ctrf-io/ctrf-js/blob/main/src/builder.ts#L132)
Defined in: [builder.ts:135](https://github.com/ctrf-io/ctrf-js/blob/main/src/builder.ts#L135)

Set the environment information.

Expand All @@ -193,7 +193,7 @@ Set the environment information.

> **addTest**(`test`): `this`

Defined in: [builder.ts:140](https://github.com/ctrf-io/ctrf-js/blob/main/src/builder.ts#L140)
Defined in: [builder.ts:143](https://github.com/ctrf-io/ctrf-js/blob/main/src/builder.ts#L143)

Add a single test.

Expand All @@ -213,7 +213,7 @@ Add a single test.

> **addTests**(`tests`): `this`

Defined in: [builder.ts:148](https://github.com/ctrf-io/ctrf-js/blob/main/src/builder.ts#L148)
Defined in: [builder.ts:151](https://github.com/ctrf-io/ctrf-js/blob/main/src/builder.ts#L151)

Add multiple tests.

Expand All @@ -229,11 +229,31 @@ Add multiple tests.

***

### addError()

> **addError**(`error`): `this`

Defined in: [builder.ts:159](https://github.com/ctrf-io/ctrf-js/blob/main/src/builder.ts#L159)

Add a global error without changing test counts.

#### Parameters

##### error

[`GlobalError`](../interfaces/GlobalError.md)

#### Returns

`this`

***

### insights()

> **insights**(`insights`): `this`

Defined in: [builder.ts:156](https://github.com/ctrf-io/ctrf-js/blob/main/src/builder.ts#L156)
Defined in: [builder.ts:167](https://github.com/ctrf-io/ctrf-js/blob/main/src/builder.ts#L167)

Set run-level insights.

Expand All @@ -253,7 +273,7 @@ Set run-level insights.

> **baseline**(`baseline`): `this`

Defined in: [builder.ts:164](https://github.com/ctrf-io/ctrf-js/blob/main/src/builder.ts#L164)
Defined in: [builder.ts:175](https://github.com/ctrf-io/ctrf-js/blob/main/src/builder.ts#L175)

Set the baseline reference.

Expand All @@ -273,7 +293,7 @@ Set the baseline reference.

> **extra**(`data`): `this`

Defined in: [builder.ts:172](https://github.com/ctrf-io/ctrf-js/blob/main/src/builder.ts#L172)
Defined in: [builder.ts:183](https://github.com/ctrf-io/ctrf-js/blob/main/src/builder.ts#L183)

Set extra metadata.

Expand All @@ -293,7 +313,7 @@ Set extra metadata.

> **summaryOverrides**(`overrides`): `this`

Defined in: [builder.ts:181](https://github.com/ctrf-io/ctrf-js/blob/main/src/builder.ts#L181)
Defined in: [builder.ts:192](https://github.com/ctrf-io/ctrf-js/blob/main/src/builder.ts#L192)

Override specific summary fields.
Useful when you want to set specific timing or counts.
Expand All @@ -314,7 +334,7 @@ Useful when you want to set specific timing or counts.

> **build**(): [`CTRFReport`](../interfaces/CTRFReport.md)

Defined in: [builder.ts:190](https://github.com/ctrf-io/ctrf-js/blob/main/src/builder.ts#L190)
Defined in: [builder.ts:201](https://github.com/ctrf-io/ctrf-js/blob/main/src/builder.ts#L201)

Build and return the CTRF report.

Expand Down
Loading
Loading