You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Based on the discussion in [#1](https://github.com/js-reporters/js-reporters/issues/1#issuecomment-54841874), this is the suggested _minimum_ set of event names to be triggered by a testing framework, to be consumed by reporters or other testing tools.
34
+
### Details
35
35
36
-
-`runStart`: Indicates the beginning of a testsuite, triggered just once.
37
-
-`suiteStart`: Triggered at the start of each group of tests within a testsuite.
38
-
-`testStart`: Triggered at the start of each test.
39
-
-`testEnd`: Triggered at the end of each test.
40
-
-`suiteEnd`: Triggered at the end of each group of tests within a testsuite.
41
-
-`runEnd`: Indicates the end of a testsuite, triggered just once.
42
-
43
-
#### Selection Criteria
44
-
45
-
The criteria for picking these event names included:
46
-
47
-
- These use the most common terms across a selection of frameworks, as gathered in [#1](https://github.com/js-reporters/js-reporters/issues/1#issuecomment-54841874)
48
-
- It uses names that are valid JavaScript identifiers, which allows using those as keys in JSON and avoids the need to quote keys in regular JS objects or function calls.
49
-
- It doesn't overlap with any known existing events, so introducing these could be done in parallel to the existing API in each framework, optionally deprecating and eventually removing the previous API.
50
-
51
-
#### Reporting Order
52
-
53
-
The recommended **reporting order** for emitting the aformentioned events with their related data should be done in **source order**. Please note that execution order is different from reporting order, that's why we don't assume any specific execution order, but we recommend whatever is higher up in the source file should be emitted first.
54
-
55
-
For more background check [#62](https://github.com/js-reporters/js-reporters/issues/62).
56
-
57
-
### Event Data
58
-
59
-
Based on the discussion in [#12](https://github.com/js-reporters/js-reporters/issues/12#issuecomment-120483356), there are two basic data structures: **Suites** and **Tests**. A test represents an atomic test/spec/`it()`. A suite contains tests and optionally other suites.
60
-
61
-
The structures have been divided in two parts, a start part and an end part:
62
-
63
-
- SuiteStart
64
-
- SuiteEnd
65
-
- TestStart
66
-
- TestEnd
67
-
68
-
For `testStart` and `testEnd`, the corresponding TestStart, respectively TestEnd, object is passed to the reporter. The same applies to `suiteStart` and `suiteEnd` where the matching SuiteStart/SuiteEnd object is passed to the reporter. For `runStart` and `runEnd` a "global" suite object is passed to the reporter, this suite wraps all other top-level user defined suites as its child suites, it will be reffered to as `globalSuite`.
69
-
70
-
The data structures are defined as follows:
71
-
72
-
-**SuiteStart**: `Object` - A SuiteStart is a collection of test-starts and potentially other suite-starts, emitted before the suite have been executed, which means before executing any of its tests and child suites.
73
-
-**name**: `String|undefined` - name of the suite, will be `undefined` only for the `globalSuite`.
74
-
-**fullname**: `Array` - array of strings containing the name of the suite and the names of all its suites ancestors.
75
-
-**tests**: `Array` - array containing all tests that directly belong to the suite (but not to a child suite).
76
-
-**childSuites**: `Array` - array with all direct subsuites.
77
-
-**testCounts**: `Object` - contains the total number of tests in the suite, including the tests of the child suites.
78
-
-**total**: `Number` - total number of tests
79
-
80
-
-**SuiteEnd**: `Object` - A SuiteEnd is a collection of test-ends and potentially other suite-ends, emitted after the suite has been executed, which means that all its tests and child suites have been also executed. **In addition** to the properties of `SuiteStart`, `SuiteEnd` also has the following properties:
81
-
-**status**: `String` - summarized status of the suite.
82
-
-`failed`, if at least one test in the suite or in its child suites has failed.
83
-
-`skipped`, if all tests in the suite and in its child suites are skipped (and there is at least one skipped test).
84
-
-`todo`, if all tests in the suite and in its child suites are todo (and there is at least one todo test).
85
-
-`passed`, if there is at least one passed test in the suite or in its child suites and all other tests are skipped or todo, or if there are no tests in the suite.
86
-
-**testCounts**: `Object` - contains how many tests have passed, failed etc. including the tests of child suites.
87
-
-**passed**: `Number` - number of passed tests.
88
-
-**failed**: `Number` - number of failed tests.
89
-
-**skipped**: `Number` - number of skipped tests.
90
-
-**todo**: `Number` - number of todo tests.
91
-
-**total**: `Number` - total number of tests, the sum of the above properties must equal this one.
92
-
-**runtime**: `Number` - execution time of the whole suite in milliseconds (including child suites).
93
-
94
-
The above `suite properties` apply also for the `globalSuite`.
95
-
96
-
-**TestStart**: `Object` - A test-start holds basic information on a single test/spec before its execution.
97
-
-**name**: `String` - name of the test.
98
-
-**suiteName**: `String` - name of the suite the test belongs to.
99
-
-**fullName**: `Array` - array of strings containing the name of the test and the names of all its suites ancestors.1
100
-
101
-
-**TestEnd**: `Object` - A test-end holds basic information on a single test/spec after its execution.
102
-
-**name**: `String` - name of the test.
103
-
-**suiteName**: `String` - name of the suite the test belongs to.
104
-
-**fullName**: `Array` - array of strings containing the name of the test and the names of all its suites ancestors.
105
-
-**status**: `String` - result of the test. Can be:
106
-
-`passed`, if all assertions have passed.
107
-
-`failed`, if at least one assertion has failed or if the test is todo and all assertions passed.
108
-
-`skipped`, if the test is disabled and wasn't executed.
109
-
-`todo`, if the test is todo and at least one assertion failed.*
110
-
-**runtime**: `Number` - execution time in milliseconds.
111
-
-**errors**: `Array` - array containing all errors, i.e failed Assertions. It will contain at least one error for failed statuses and it will be empty for statuses other than failed.
112
-
-**assertions**: `Array` - array of Assertions containing all assertions passed and failed, for a skipped test there will be an empty array. Frameworks that don't track passed assertions can always provide an empty array for passed tests. In that case, for failed tests this should match the errors property.
113
-
114
-
_*For more info about todo tests, please refer to the [QUnit documentation for todo tests](https://api.qunitjs.com/QUnit.todo/) and the [TAP 13 specification on the todo directive](https://testanything.org/tap-version-13-specification.html#directives)_.
115
-
116
-
Based on the discussion in [#79](https://github.com/js-reporters/js-reporters/issues/79), js-reporters establishes also a minimum set of properties for the emitted assertions, failed or passed:
117
-
118
-
-**Assertion**: `Object` - An object which contains information of a single assertion/expectation.
119
-
-**passed**: `Boolean` - `true` for a passed assertion, `failed` for a failed assertion.
120
-
-**actual**: `*` - the actual value passed to the assertion, should coincide with `expected` for passed assertions.
121
-
-**expected**: `*` - the expected value passed to the assertion, should coincide with `actual` for passed assertions.
122
-
-**message**: `String` - a description.
123
-
-**stack**: `String|undefined` - represents the stack trace for a failed assertion, for a `passed` one it is `undefined`.
124
-
-**todo**: `Boolean` - whether this assertion was part of a todo test
125
-
126
-
Additional properties (not defined here) can be added to the Assertion object. If Assertion objects are included in the Test and Suite objects defined above, it is recommended to remove the `actual` and `expected` values after `TestEnd` occurs to avoid leaking memory.
127
-
128
-
## Details
129
-
130
-
For details please check out the [docs](docs) and especially the [example](docs/example.md) which presents a testsuite and its reporting data based on the standard presented above.
36
+
For details please check out the [docs](docs/) and especially the [example](docs/example.md) which presents a testsuite and its reporting data based on the standard presented above.
131
37
132
38
For implementation examples please check [Usage of the adapters](#usage-of-the-adapters) and [Integrations](#integrations).
133
39
134
-
## Usage of the adapters
40
+
## Usage
135
41
136
42
Listen to the events and receive the emitted data:
0 commit comments