@reporters/junit 1.2.1 → 1.2.3

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/index.js CHANGED
@@ -4,7 +4,7 @@ const { hostname } = require('node:os');
4
4
  const HOSTNAME = hostname();
5
5
 
6
6
  function escapeProperty(s = '') {
7
- return s.replace(/"/g, '\\"');
7
+ return s.replace(/"/g, '\\"').replace(/\n/g, '');
8
8
  }
9
9
 
10
10
  function escapeContent(s = '') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reporters/junit",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
4
4
  "description": "A jUnit reporter for `node:test`",
5
5
  "keywords": [
6
6
  "junit",
@@ -9,6 +9,9 @@
9
9
  "reporter",
10
10
  "reporters"
11
11
  ],
12
+ "files": [
13
+ "./index.js"
14
+ ],
12
15
  "scripts": {
13
16
  "test": "node --test-reporter=spec --test-reporter-destination=stdout --test-reporter=../github/index.js --test-reporter-destination=stdout --test"
14
17
  },
package/CHANGELOG.md DELETED
@@ -1,60 +0,0 @@
1
- # Changelog
2
-
3
- ## [1.2.1](https://github.com/MoLow/reporters/compare/junit-v1.2.0...junit-v1.2.1) (2023-07-19)
4
-
5
-
6
- ### Bug Fixes
7
-
8
- * more accurate counting ([1949140](https://github.com/MoLow/reporters/commit/19491406b769f03555b3ae352ed9838e2154c855))
9
-
10
- ## [1.2.0](https://github.com/MoLow/reporters/compare/junit-v1.1.0...junit-v1.2.0) (2023-07-05)
11
-
12
-
13
- ### Features
14
-
15
- * publish with provenance ([6ee1e46](https://github.com/MoLow/reporters/commit/6ee1e46040329edeb0f40f753093b6952984f001))
16
-
17
- ## [1.1.0](https://github.com/MoLow/reporters/compare/junit-v1.0.4...junit-v1.1.0) (2023-05-30)
18
-
19
-
20
- ### Features
21
-
22
- * report node 20 features ([c99a76c](https://github.com/MoLow/reporters/commit/c99a76c0f6bef75abb2c053c82c88448b0c82690))
23
-
24
- ## [1.0.4](https://github.com/MoLow/reporters/compare/junit-v1.0.3...junit-v1.0.4) (2023-04-03)
25
-
26
-
27
- ### Bug Fixes
28
-
29
- * allow multiple roots ([590df94](https://github.com/MoLow/reporters/commit/590df948f8a4626fc29e8ce185e08d2226a307ba))
30
-
31
- ## [1.0.3](https://github.com/MoLow/reporters/compare/junit-v1.0.2...junit-v1.0.3) (2023-03-12)
32
-
33
-
34
- ### Bug Fixes
35
-
36
- * **junit:** support more usecases ([72359c3](https://github.com/MoLow/reporters/commit/72359c3983334d7712c4d404a0ae297b9ef9e859))
37
-
38
- ## [1.0.2](https://github.com/MoLow/reporters/compare/junit-v1.0.1...junit-v1.0.2) (2022-12-25)
39
-
40
-
41
- ### Bug Fixes
42
-
43
- * some package.json links ([c51a616](https://github.com/MoLow/reporters/commit/c51a61648e29f5baca539ded1b09c2af3f5e0a4a))
44
-
45
- ## [1.0.1](https://github.com/MoLow/reporters/compare/junit-v1.0.0...junit-v1.0.1) (2022-12-20)
46
-
47
-
48
- ### Bug Fixes
49
-
50
- * fix monorepos release ([8386ef0](https://github.com/MoLow/reporters/commit/8386ef0ea7bfe0c0325e171aa7122eeccb17bad3))
51
- * fix monorepos release ([3c5ee61](https://github.com/MoLow/reporters/commit/3c5ee6126fe961363b3feccf1ba6594a0849855b))
52
- * fix monorepos release ([7eebffb](https://github.com/MoLow/reporters/commit/7eebffb46ab627beaa2b10023a08dd3271f819e9))
53
- * fix monorepos release ([9c66f37](https://github.com/MoLow/reporters/commit/9c66f37b010f782e70c3cdf2bf827d30c4aa71c2))
54
- * fix monorepos release ([d844919](https://github.com/MoLow/reporters/commit/d844919c8684216155b8f1c0acc98d907b3a5cdb))
55
- * fix monorepos release ([d5610e2](https://github.com/MoLow/reporters/commit/d5610e29db730dc4ffa3f9721a85d5f3c7749b2c))
56
- * reset changelogs ([1e114ce](https://github.com/MoLow/reporters/commit/1e114ced7201cf9897f2cf79b5a4fb46f1b085fb))
57
-
58
- ## 1.0.0 (2022-12-19)
59
-
60
- Initial release
@@ -1,37 +0,0 @@
1
- const { test } = require('node:test');
2
- const { spawnSync } = require('child_process');
3
- const assert = require('assert');
4
- const { compareLines } = require('../../../tests/utils');
5
- const reporter = require('../index');
6
- const output = require('./output');
7
-
8
- test('spwan with reporter', () => {
9
- const child = spawnSync(process.execPath, ['--test-reporter', './index.js', '../../tests/example'], { env: {} });
10
- assert.strictEqual(child.stderr?.toString(), '');
11
- compareLines(child.stdout?.toString(), output.stdout);
12
- });
13
-
14
- test('empty', async () => {
15
- const lines = [];
16
- for await (const line of reporter([])) {
17
- lines.push(line);
18
- }
19
- assert.deepStrictEqual(lines, [
20
- '<?xml version="1.0" encoding="utf-8"?>\n',
21
- '<testsuites>\n',
22
- '</testsuites>\n',
23
- ]);
24
- });
25
-
26
- test('single test', async () => {
27
- const lines = [];
28
- for await (const line of reporter([{ type: 'test:pass', data: { name: 'test', nesting: 0, details: { duration_ms: 100 } } }])) {
29
- lines.push(line);
30
- }
31
- assert.deepStrictEqual(lines, [
32
- '<?xml version="1.0" encoding="utf-8"?>\n',
33
- '<testsuites>\n',
34
- '\t<undefined name="root">\n\t<testcase name="test" time="0.100000" classname="test"/>\n\t</undefined>\n',
35
- '</testsuites>\n',
36
- ]);
37
- });
package/tests/output.js DELETED
@@ -1,37 +0,0 @@
1
- module.exports = {
2
- stdout: `<\\?xml version="1.0" encoding="utf-8"\\?>
3
- <testsuites>
4
- \t<testsuite name="tests" time=".*" disabled="0" errors="0" tests="3" failures="1" skipped="0" hostname=".*">
5
- \t\t<testcase name="is ok" time=".*" classname="test"/>
6
- \t\t<testcase name="fails" time=".*" classname="test" failure="this is an error">
7
- \t\t\t<failure type="testCodeFailure" message="this is an error">
8
- \\[Error \\[ERR_TEST_FAILURE\\]: this is an error\\] {
9
- failureType: 'testCodeFailure',
10
- cause: Error: this is an error
11
- .*
12
- .*
13
- .*
14
- .*
15
- .*
16
- .*
17
- .*
18
- .*
19
- .*
20
- code: 'ERR_TEST_FAILURE'
21
- }
22
- \t\t\t</failure>
23
- \t\t</testcase>
24
- \t\t<testcase name="is a diagnostic" time=".*" classname="test"/>
25
- \t</testsuite>
26
- \t<testsuite name="more tests" time=".*" disabled="0" errors="0" tests="1" failures="0" skipped="0" hostname=".*">
27
- \t\t<testcase name="is ok" time=".*" classname="test"/>
28
- \t</testsuite>
29
- \t<testcase name="is skipped" time=".* classname="test">
30
- \t\t<skipped type="skipped" message="true"/>
31
- \t</testcase>
32
- \t<testcase name="is a todo" time=".*" classname="test">
33
- \t\t<skipped type="todo" message="true"/>
34
- \t</testcase>
35
- </testsuites>
36
- `,
37
- };