@reporters/junit 1.0.1 → 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 CHANGED
@@ -1,5 +1,12 @@
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
+
3
10
  ## [1.0.1](https://github.com/MoLow/reporters/compare/junit-v1.0.0...junit-v1.0.1) (2022-12-20)
4
11
 
5
12
 
package/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  [![npm version](https://img.shields.io/npm/v/@reporters/github)](https://www.npmjs.com/package/@reporters/github) ![tests](https://github.com/MoLow/reporters/actions/workflows/test.yaml/badge.svg?branch=main)
2
2
  # Junit Reporter
3
- 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.
4
5
 
5
6
  ## Installation
6
7
 
@@ -22,3 +23,39 @@ node --test \
22
23
 
23
24
  ## Example
24
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.&lt;anonymous&gt; (/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.1",
4
- "description": "A junit reporter for `node:test`",
3
+ "version": "1.0.2",
4
+ "description": "A jUnit reporter for `node:test`",
5
5
  "keywords": [
6
6
  "junit",
7
7
  "node:test",
@@ -10,9 +10,13 @@
10
10
  "reporters"
11
11
  ],
12
12
  "scripts": {
13
- "test": "echo ''"
13
+ "test": "../../prebuilt --test"
14
+ },
15
+ "bugs": {
16
+ "url": "https://github.com/MoLow/reporters/issues"
14
17
  },
15
18
  "main": "index.js",
19
+ "homepage": "https://github.com/MoLow/reporters/tree/main/packages/junit",
16
20
  "repository": "https://github.com/MoLow/reporters.git",
17
21
  "author": "Moshe Atlow",
18
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);
@@ -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.&lt;anonymous&gt; (.*)
12
+ .*
13
+ .*
14
+ .*
15
+ .*
16
+ .*
17
+ .*
18
+ .*
19
+ code: 'ERR_TEST_FAILURE'
20
+ }
21
+ </failure>
22
+ </testcase>
23
+ </testsuite>
24
+ </testsuites>
25
+ `,
26
+ };