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
Spec: Rewrite current proposal into a formal specification
Rewrite the current proposal into a formal specification using
normative language.
I've converted this file from Markdown to AsciiDoc to enable important
navigation and rich-text features that make long-form documents easier
to comprehend and link to. Such as an automatic table of contents,
section numbering, and "note" blocks for non-normative notes.
Added:
* Write a new "Terminology" section, with examples to explain how these
terms relate to QUnit, Mocha, Jasmine, JUnit and xUnit.
* Write down the ordering requirements for events (previously missing).
* Write a new "Runner API" section, basically just `on()`.
* Write a new "Reporter API" section, basically just `init()`.
Changed:
* Clarify that Event data is treated as plain objects.
Use of private utility classes is allowed, but not required.
* Fix type of TestEnd "suite" name to be `string|undefined` since
tests under the global suite have undefined as their suite name.
Removed:
* Remove any sentences about when events emit in relation to execution,
so that there is no guruantee or promise of being able to influence or
observe test execution by non-standard itself.
This is important as otherwise testing frameworks or adapters could not
conform to the standard if they use child processes or web workers, or
if e.g. a proxy reporter forwards the events over a socket to a server
or remote control client where then other reporters can be plugged in.
* Remove sentence about deleting `actual` and `expected` properties
after emitting TestEnd events "to avoid leaking memory". This was never
done in practice and appears to not be an issue in most reporters so
long as callbacks just let objects naturally get garbage-collected.
* Remove any implied inheritance or other relation between
TestStart/TestEnd and SuiteStart/SuiteEnd. This felt confusing
because these are not defined as actual classes, and actually
were not strictly supersets either because SuiteStart defined
a list of TestStart and SuiteStart objects, whereas SuiteEnd
is and should be given a list of TestEnd and SuiteEnd objects.
In 2014, the [QUnit](https://qunitjs.com/) team started [discussing](https://github.com/qunitjs/qunit/issues/531) the possibility of interoperability between JavaScript test frameworks such as QUnit, Mocha, Jasmine, Intern, Buster, etc. The "Common Reporter Interface" would be an allow integrations for output formats and communication bridges to be shared between frameworks. This would also benefit high-level consumers of these frameworks such as Karma, BrowserStack, SauceLabs, Testling, by having a standard machine-readable interface.
33
+
In 2014, the [QUnit](https://qunitjs.com/) team started [discussing](https://github.com/qunitjs/qunit/issues/531) the possibility of interoperability between JavaScript testing frameworks such as QUnit, Mocha, Jasmine, Intern, Buster, etc. The "Common Reporter Interface" would be an allow integrations for output formats and communication bridges to be shared between frameworks. This would also benefit high-level consumers of these frameworks such as Karma, BrowserStack, SauceLabs, Testling, by having a standard machine-readable interface.
18
34
19
35
Our mission is to deliver:
20
36
21
37
- a common JavaScript API, e.g. based on EventEmitter featuring `.on()` and `.off()`.
22
38
- a minimum viable set of events with standardized event names and event data.
23
39
- a minimum viable set of concepts behind those events to allow consumers to set expectations (e.g. define what "pass", "fail", "skip", "todo", and "pending" mean).
24
-
- work with participating test frameworks to support the Common Reporter Interface.
40
+
- work with participating testing frameworks to support the Common Reporter Interface.
25
41
26
42
Would _you_ be interested in discussing this with us further? Please join in!
*[Join the Chat room](https://gitter.im/qunitjs/qunit)
45
+
*[Browse open issues](https://github.com/js-reporters/js-reporters/issues/)
46
+
*[Help frameworks and runners implement the spec](#cross-project-coordination)
29
47
30
-
## Specification
48
+
## js-reporters Package
31
49
32
-
See [CRI Specification](docs/cri-draft.md).
33
-
34
-
### Details
35
-
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.
37
-
38
-
For implementation examples please check [Usage of the adapters](#usage-of-the-adapters) and [Integrations](#integrations).
39
-
40
-
## Usage
50
+
### Usage
41
51
42
52
Listen to the events and receive the emitted data:
43
53
@@ -46,11 +56,11 @@ Listen to the events and receive the emitted data:
46
56
construnner=JsReporters.autoRegister();
47
57
48
58
// Listen to the same events for any testing framework.
49
-
runner.on('testEnd', function(test) {
59
+
runner.on('testEnd', function(test) {
50
60
console.log('Test %s has errors:', test.fullname.join(''), test.errors);
Auto registers one of the existing adapters by checking for existing testing frameworks in the global scope and returns the runner to attach event listeners. If no framework is found, it will throw an `Error`.
85
+
Automatically detects which testing framework you use and attaches any adapters as needed, and returns a compatible runner object. If no framework is found, it will throw an `Error`.
This section is dedicated to explain the limitations of the adapters in respect to the standard.
93
+
Runners:
88
94
89
-
The only limitation is the emitting order, which is not done in source order:
95
+
*[QUnit](https://qunitjs.com/), natively since [QUnit 2.2](https://github.com/qunitjs/qunit/releases/2.2.0).
96
+
* Jasmine, via [js-reporters JasmineAdapter](lib/adapters/JasmineAdapter.js).
97
+
* Mocha, via [js-reporters MochaAdapter](lib/adapters/MochaAdapter.js).
90
98
91
-
- Jasmine: the emitting order of the tests will be the one from Jasmine
92
-
- Mocha: the emitting order of the tests will be the one from Mocha
93
-
- QUnit: the emitting order is done in suite order, which means if there is a suite that contains tests and other suites, it emits the start of the suite and then emits its tests and only after it emits the other suites, even if the tests were the last in source order
99
+
Reporters:
94
100
95
-
If you want to know more about each testing framework and about their emitting order, please checkout the [frameworks](docs/frameworks.md) document.
101
+
*[TAP](lib/reporters/TapReporter), implements the [Test Anything Protocol](https://testanything.org/) for command-line output.
102
+
*[browserstack-runner](https://github.com/browserstack/browserstack-runner/blob/0.9.1/lib/_patch/reporter.js), runs JavaScript unit tests remotely in multiple browsers, summarize the results by browser, and fail or pass the continuous integration build accordingly.
0 commit comments