@reporters/junit 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/README.md +40 -2
- package/package.json +9 -2
- package/tests/index.test.js +9 -0
- package/tests/output.js +26 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.0.2](https://github.com/MoLow/reporters/compare/junit-v1.0.1...junit-v1.0.2) (2022-12-25)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* some package.json links ([c51a616](https://github.com/MoLow/reporters/commit/c51a61648e29f5baca539ded1b09c2af3f5e0a4a))
|
|
9
|
+
|
|
10
|
+
## [1.0.1](https://github.com/MoLow/reporters/compare/junit-v1.0.0...junit-v1.0.1) (2022-12-20)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* fix monorepos release ([8386ef0](https://github.com/MoLow/reporters/commit/8386ef0ea7bfe0c0325e171aa7122eeccb17bad3))
|
|
16
|
+
* fix monorepos release ([3c5ee61](https://github.com/MoLow/reporters/commit/3c5ee6126fe961363b3feccf1ba6594a0849855b))
|
|
17
|
+
* fix monorepos release ([7eebffb](https://github.com/MoLow/reporters/commit/7eebffb46ab627beaa2b10023a08dd3271f819e9))
|
|
18
|
+
* fix monorepos release ([9c66f37](https://github.com/MoLow/reporters/commit/9c66f37b010f782e70c3cdf2bf827d30c4aa71c2))
|
|
19
|
+
* fix monorepos release ([d844919](https://github.com/MoLow/reporters/commit/d844919c8684216155b8f1c0acc98d907b3a5cdb))
|
|
20
|
+
* fix monorepos release ([d5610e2](https://github.com/MoLow/reporters/commit/d5610e29db730dc4ffa3f9721a85d5f3c7749b2c))
|
|
21
|
+
* reset changelogs ([1e114ce](https://github.com/MoLow/reporters/commit/1e114ced7201cf9897f2cf79b5a4fb46f1b085fb))
|
|
22
|
+
|
|
3
23
|
## 1.0.0 (2022-12-19)
|
|
4
24
|
|
|
5
25
|
Initial release
|
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
[](https://www.npmjs.com/package/@reporters/github) 
|
|
1
2
|
# Junit Reporter
|
|
2
|
-
A Junit reporter for `node:test
|
|
3
|
+
A Junit reporter for `node:test`.
|
|
4
|
+
intendend for use with major CI tools like Jenkins, CircleCI, etc that consume Junit reports.
|
|
3
5
|
|
|
4
6
|
## Installation
|
|
5
7
|
|
|
@@ -19,5 +21,41 @@ node --test \
|
|
|
19
21
|
--test-reporter=spec --test-reporter-destination=stdout
|
|
20
22
|
```
|
|
21
23
|
|
|
22
|
-
## Example
|
|
24
|
+
## Example
|
|
23
25
|
|
|
26
|
+
Ouput of the following test file:
|
|
27
|
+
|
|
28
|
+
```js
|
|
29
|
+
const { describe, it } = require('node:test');
|
|
30
|
+
|
|
31
|
+
describe('tests', () => {
|
|
32
|
+
it('is ok', () => {});
|
|
33
|
+
it('fails', () => {
|
|
34
|
+
throw new Error('this is an error');
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
```xml
|
|
40
|
+
<testsuite name="tests" time="0.00239" disabled="0" errors="0" tests="2" failures="1" skipped="0" hostname="PC.localdomain">
|
|
41
|
+
<testcase name="is ok" time="0.00057" classname="test"></testcase>
|
|
42
|
+
<testcase name="fails" time="0.00017" classname="test" failure="this is an error">
|
|
43
|
+
<failure message="this is an error" type="testCodeFailure">
|
|
44
|
+
[Error [ERR_TEST_FAILURE]: this is an error] {
|
|
45
|
+
failureType: 'testCodeFailure',
|
|
46
|
+
cause: Error: this is an error
|
|
47
|
+
at Object.<anonymous> (/Users/test/reporters/tests/example.js:6:11)
|
|
48
|
+
at ItTest.runInAsyncScope (node:async_hooks:204:9)
|
|
49
|
+
at ItTest.run (node:internal/test_runner/test:547:25)
|
|
50
|
+
at Suite.processPendingSubtests (node:internal/test_runner/test:302:27)
|
|
51
|
+
at ItTest.postRun (node:internal/test_runner/test:632:19)
|
|
52
|
+
at ItTest.run (node:internal/test_runner/test:575:10)
|
|
53
|
+
at async Promise.all (index 0)
|
|
54
|
+
at async Suite.run (node:internal/test_runner/test:798:7),
|
|
55
|
+
code: 'ERR_TEST_FAILURE'
|
|
56
|
+
}
|
|
57
|
+
</failure>
|
|
58
|
+
</testcase>
|
|
59
|
+
</testsuite>
|
|
60
|
+
</testsuites>
|
|
61
|
+
```
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reporters/junit",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "A
|
|
3
|
+
"version": "1.0.2",
|
|
4
|
+
"description": "A jUnit reporter for `node:test`",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"junit",
|
|
7
7
|
"node:test",
|
|
@@ -9,7 +9,14 @@
|
|
|
9
9
|
"reporter",
|
|
10
10
|
"reporters"
|
|
11
11
|
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"test": "../../prebuilt --test"
|
|
14
|
+
},
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/MoLow/reporters/issues"
|
|
17
|
+
},
|
|
12
18
|
"main": "index.js",
|
|
19
|
+
"homepage": "https://github.com/MoLow/reporters/tree/main/packages/junit",
|
|
13
20
|
"repository": "https://github.com/MoLow/reporters.git",
|
|
14
21
|
"author": "Moshe Atlow",
|
|
15
22
|
"license": "MIT"
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const { spawnSync } = require('child_process');
|
|
2
|
+
const assert = require('assert');
|
|
3
|
+
const { compareLines } = require('../../../tests/utils');
|
|
4
|
+
const output = require('./output');
|
|
5
|
+
|
|
6
|
+
const child = spawnSync(process.execPath, ['--test-reporter', './index.js', '../../tests/example']);
|
|
7
|
+
|
|
8
|
+
assert.strictEqual(child.stderr?.toString(), '');
|
|
9
|
+
compareLines(child.stdout?.toString(), output.stdout);
|
package/tests/output.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
stdout: `<\\?xml version="1.0" encoding="utf-8"\\?>
|
|
3
|
+
<testsuites>
|
|
4
|
+
<testsuite name="tests" time=".*" disabled="0" errors="0" tests="2" failures="1" skipped="0" hostname=".*">
|
|
5
|
+
<testcase name="is ok" time=".*" classname="test"></testcase>
|
|
6
|
+
<testcase name="fails" time=".*" classname="test" failure="this is an error">
|
|
7
|
+
<failure message="this is an error" type="testCodeFailure">
|
|
8
|
+
\\[Error \\[ERR_TEST_FAILURE\\]: this is an error\\] {
|
|
9
|
+
failureType: 'testCodeFailure',
|
|
10
|
+
cause: Error: this is an error
|
|
11
|
+
at Object.<anonymous> (.*)
|
|
12
|
+
.*
|
|
13
|
+
.*
|
|
14
|
+
.*
|
|
15
|
+
.*
|
|
16
|
+
.*
|
|
17
|
+
.*
|
|
18
|
+
.*
|
|
19
|
+
code: 'ERR_TEST_FAILURE'
|
|
20
|
+
}
|
|
21
|
+
</failure>
|
|
22
|
+
</testcase>
|
|
23
|
+
</testsuite>
|
|
24
|
+
</testsuites>
|
|
25
|
+
`,
|
|
26
|
+
};
|