Skip to content
Merged
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
15 changes: 13 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
**CTRF v0.0.15**
**CTRF v0.0.16**

***

# CTRF v0.0.15
# CTRF v0.0.16

## Enumerations

Expand All @@ -21,22 +21,33 @@
- [Summary](interfaces/Summary.md)
- [Test](interfaces/Test.md)
- [TestInsights](interfaces/TestInsights.md)
- [TestTree](interfaces/TestTree.md)
- [Tool](interfaces/Tool.md)
- [TreeNode](interfaces/TreeNode.md)
- [TreeOptions](interfaces/TreeOptions.md)
- [ValidationResult](interfaces/ValidationResult.md)

## Type Aliases

- [TestStatus](type-aliases/TestStatus.md)
- [TreeTest](type-aliases/TreeTest.md)

## Functions

- [enrichReportWithInsights](functions/enrichReportWithInsights.md)
- [findSuiteByName](functions/findSuiteByName.md)
- [findTestByName](functions/findTestByName.md)
- [flattenTree](functions/flattenTree.md)
- [getAllTests](functions/getAllTests.md)
- [getSuiteStats](functions/getSuiteStats.md)
- [isValidCtrfReport](functions/isValidCtrfReport.md)
- [mergeReports](functions/mergeReports.md)
- [organizeTestsBySuite](functions/organizeTestsBySuite.md)
- [readReportFromFile](functions/readReportFromFile.md)
- [readReportsFromDirectory](functions/readReportsFromDirectory.md)
- [readReportsFromGlobPattern](functions/readReportsFromGlobPattern.md)
- [sortReportsByTimestamp](functions/sortReportsByTimestamp.md)
- [storePreviousResults](functions/storePreviousResults.md)
- [traverseTree](functions/traverseTree.md)
- [validateReport](functions/validateReport.md)
- [validateReportStrict](functions/validateReportStrict.md)
2 changes: 1 addition & 1 deletion docs/enumerations/SortOrder.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[**CTRF v0.0.15**](../README.md)
[**CTRF v0.0.16**](../README.md)

***

Expand Down
2 changes: 1 addition & 1 deletion docs/functions/enrichReportWithInsights.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[**CTRF v0.0.15**](../README.md)
[**CTRF v0.0.16**](../README.md)

***

Expand Down
33 changes: 33 additions & 0 deletions docs/functions/findSuiteByName.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[**CTRF v0.0.16**](../README.md)

***

[CTRF](../README.md) / findSuiteByName

# Function: findSuiteByName()

> **findSuiteByName**(`nodes`, `name`): `undefined` \| [`TreeNode`](../interfaces/TreeNode.md)

Defined in: src/methods/tree-hierarchical-structure.ts:331

Utility function to find a suite by name in the tree

## Parameters

### nodes

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

Array of tree nodes to search

### name

`string`

Name of the suite to find

## Returns

`undefined` \| [`TreeNode`](../interfaces/TreeNode.md)

The found suite node or undefined
33 changes: 33 additions & 0 deletions docs/functions/findTestByName.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[**CTRF v0.0.16**](../README.md)

***

[CTRF](../README.md) / findTestByName

# Function: findTestByName()

> **findTestByName**(`nodes`, `name`): `undefined` \| [`TreeTest`](../type-aliases/TreeTest.md)

Defined in: src/methods/tree-hierarchical-structure.ts:354

Utility function to find a test by name in the tree

## Parameters

### nodes

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

Array of tree nodes to search

### name

`string`

Name of the test to find

## Returns

`undefined` \| [`TreeTest`](../type-aliases/TreeTest.md)

The found test or undefined
28 changes: 28 additions & 0 deletions docs/functions/flattenTree.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[**CTRF v0.0.16**](../README.md)

***

[CTRF](../README.md) / flattenTree

# Function: flattenTree()

> **flattenTree**(`nodes`): `object`[]

Defined in: src/methods/tree-hierarchical-structure.ts:379

Utility function to convert tree to a flat array with indentation information
Useful for displaying the tree in a linear format

## Parameters

### nodes

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

Array of tree nodes to flatten

## Returns

`object`[]

Array of objects containing node, depth, and nodeType information
27 changes: 27 additions & 0 deletions docs/functions/getAllTests.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[**CTRF v0.0.16**](../README.md)

***

[CTRF](../README.md) / getAllTests

# Function: getAllTests()

> **getAllTests**(`nodes`): [`TreeTest`](../type-aliases/TreeTest.md)[]

Defined in: src/methods/tree-hierarchical-structure.ts:403

Utility function to get all tests from the tree structure as a flat array

## Parameters

### nodes

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

Array of tree nodes to extract tests from

## Returns

[`TreeTest`](../type-aliases/TreeTest.md)[]

Array of all tests in the tree
33 changes: 33 additions & 0 deletions docs/functions/getSuiteStats.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[**CTRF v0.0.16**](../README.md)

***

[CTRF](../README.md) / getSuiteStats

# Function: getSuiteStats()

> **getSuiteStats**(`nodes`, `suitePath`): `undefined` \| [`Summary`](../interfaces/Summary.md)

Defined in: src/methods/tree-hierarchical-structure.ts:422

Utility function to get statistics for a specific suite path

## Parameters

### nodes

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

Array of tree nodes to search

### suitePath

`string`[]

Array representing the path to the suite

## Returns

`undefined` \| [`Summary`](../interfaces/Summary.md)

Summary statistics for the suite or undefined if not found
4 changes: 2 additions & 2 deletions docs/functions/isValidCtrfReport.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[**CTRF v0.0.15**](../README.md)
[**CTRF v0.0.16**](../README.md)

***

Expand All @@ -8,7 +8,7 @@

> **isValidCtrfReport**(`report`): `report is { reportFormat: "CTRF" }`

Defined in: src/methods/validate-schema.ts:27
Defined in: [src/methods/validate-schema.ts:27](https://github.com/ctrf-io/ctrf-core-js/blob/main/src/methods/validate-schema.ts#L27)

Simple check to verify if an object is a CTRF report by checking the reportFormat

Expand Down
2 changes: 1 addition & 1 deletion docs/functions/mergeReports.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[**CTRF v0.0.15**](../README.md)
[**CTRF v0.0.16**](../README.md)

***

Expand Down
68 changes: 68 additions & 0 deletions docs/functions/organizeTestsBySuite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
[**CTRF v0.0.16**](../README.md)

***

[CTRF](../README.md) / organizeTestsBySuite

# Function: organizeTestsBySuite()

> **organizeTestsBySuite**(`tests`, `options`): [`TestTree`](../interfaces/TestTree.md)

Defined in: src/methods/tree-hierarchical-structure.ts:92

Organizes CTRF tests into a hierarchical tree structure based on the suite property.

The function handles array format (['suite1', 'suite2', 'suite3']) for the suite property
as defined in the CTRF schema. The output follows the CTRF Suite Tree schema specification.

## Parameters

### tests

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

Array of CTRF test objects

### options

[`TreeOptions`](../interfaces/TreeOptions.md) = `{}`

Options for controlling tree creation

## Returns

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

TestTree object containing the hierarchical structure and statistics

## Example

```typescript
import { organizeTestsBySuite } from 'ctrf-js-common'

const tests = [
{
name: 'should login successfully',
status: 'passed',
duration: 150,
suite: ['Authentication', 'Login']
},
{
name: 'should logout successfully',
status: 'passed',
duration: 100,
suite: ['Authentication', 'Logout']
}
]

const tree = organizeTestsBySuite(tests)

// For structure-only without summary statistics:
// const tree = organizeTestsBySuite(tests, { includeSummary: false })

// Convert to JSON for machine consumption
const treeJson = JSON.stringify(tree, null, 2)

console.log(tree.roots[0].name) // 'Authentication'
console.log(tree.roots[0].suites.length) // 2 (Login, Logout)
```
2 changes: 1 addition & 1 deletion docs/functions/readReportFromFile.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[**CTRF v0.0.15**](../README.md)
[**CTRF v0.0.16**](../README.md)

***

Expand Down
2 changes: 1 addition & 1 deletion docs/functions/readReportsFromDirectory.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[**CTRF v0.0.15**](../README.md)
[**CTRF v0.0.16**](../README.md)

***

Expand Down
2 changes: 1 addition & 1 deletion docs/functions/readReportsFromGlobPattern.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[**CTRF v0.0.15**](../README.md)
[**CTRF v0.0.16**](../README.md)

***

Expand Down
2 changes: 1 addition & 1 deletion docs/functions/sortReportsByTimestamp.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[**CTRF v0.0.15**](../README.md)
[**CTRF v0.0.16**](../README.md)

***

Expand Down
2 changes: 1 addition & 1 deletion docs/functions/storePreviousResults.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[**CTRF v0.0.15**](../README.md)
[**CTRF v0.0.16**](../README.md)

***

Expand Down
37 changes: 37 additions & 0 deletions docs/functions/traverseTree.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[**CTRF v0.0.16**](../README.md)

***

[CTRF](../README.md) / traverseTree

# Function: traverseTree()

> **traverseTree**(`nodes`, `callback`, `depth`): `void`

Defined in: src/methods/tree-hierarchical-structure.ts:302

Utility function to traverse the tree and apply a function to each node

## Parameters

### nodes

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

Array of tree nodes to traverse

### callback

(`node`, `depth`, `nodeType`) => `void`

Function to call for each node (suites and tests)

### depth

`number` = `0`

Current depth in the tree (starts at 0)

## Returns

`void`
6 changes: 3 additions & 3 deletions docs/functions/validateReport.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[**CTRF v0.0.15**](../README.md)
[**CTRF v0.0.16**](../README.md)

***

Expand All @@ -8,9 +8,9 @@

> **validateReport**(`report`): [`ValidationResult`](../interfaces/ValidationResult.md)

Defined in: src/methods/validate-schema.ts:43
Defined in: [src/methods/validate-schema.ts:43](https://github.com/ctrf-io/ctrf-core-js/blob/main/src/methods/validate-schema.ts#L43)

Validates a CTRF report against the JSON schema using AJV
Validates a CTRF report against the JSON schema

## Parameters

Expand Down
Loading