@reporters/github 1.1.3 → 1.3.0
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 +14 -0
- package/README.md +0 -1
- package/index.js +2 -1
- package/package.json +1 -1
- package/tests/index.test.js +18 -10
- package/tests/{output.js → output.v18.js} +7 -3
- package/tests/output.v19.js +26 -0
- package/tests/output.v20.js +26 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.3.0](https://github.com/MoLow/reporters/compare/github-v1.2.0...github-v1.3.0) (2023-07-05)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* publish with provenance ([6ee1e46](https://github.com/MoLow/reporters/commit/6ee1e46040329edeb0f40f753093b6952984f001))
|
|
9
|
+
|
|
10
|
+
## [1.2.0](https://github.com/MoLow/reporters/compare/github-v1.1.3...github-v1.2.0) (2023-05-30)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* report node 20 features ([c99a76c](https://github.com/MoLow/reporters/commit/c99a76c0f6bef75abb2c053c82c88448b0c82690))
|
|
16
|
+
|
|
3
17
|
## [1.1.3](https://github.com/MoLow/reporters/compare/github-v1.1.2...github-v1.1.3) (2023-04-03)
|
|
4
18
|
|
|
5
19
|
|
package/README.md
CHANGED
package/index.js
CHANGED
|
@@ -20,12 +20,13 @@ const parseStack = (error, file) => {
|
|
|
20
20
|
|
|
21
21
|
const DIAGNOSTIC_KEYS = {
|
|
22
22
|
tests: 'Total Tests',
|
|
23
|
+
suites: 'Suites 📂',
|
|
23
24
|
pass: 'Passed ✅',
|
|
24
25
|
fail: 'Failed ❌',
|
|
25
26
|
cancelled: 'Canceled 🚫',
|
|
26
27
|
skipped: 'Skipped ⏭️',
|
|
27
28
|
todo: 'Todo 📝',
|
|
28
|
-
duration_ms: 'Duration',
|
|
29
|
+
duration_ms: 'Duration 🕐',
|
|
29
30
|
};
|
|
30
31
|
|
|
31
32
|
const DIAGNOSTIC_VALUES = {
|
package/package.json
CHANGED
package/tests/index.test.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const { test, describe } = require('node:test');
|
|
1
2
|
const { spawnSync } = require('child_process');
|
|
2
3
|
const { tmpdir } = require('os');
|
|
3
4
|
const { join } = require('path');
|
|
@@ -5,19 +6,26 @@ const assert = require('assert');
|
|
|
5
6
|
const path = require('path');
|
|
6
7
|
const { readFileSync, writeFileSync } = require('fs');
|
|
7
8
|
const { compareLines } = require('../../../tests/utils');
|
|
8
|
-
|
|
9
|
+
// eslint-disable-next-line import/no-dynamic-require
|
|
10
|
+
const output = require(`./output.${process.version.split('.')[0]}`);
|
|
9
11
|
|
|
10
12
|
const GITHUB_STEP_SUMMARY = join(tmpdir(), 'github-actions-test-reporter');
|
|
11
13
|
writeFileSync(GITHUB_STEP_SUMMARY, '');
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
15
|
+
describe('github reporter', () => {
|
|
16
|
+
const child = spawnSync(process.execPath, ['--test-reporter', './index.js', '../../tests/example'], {
|
|
17
|
+
env: { GITHUB_ACTIONS: true, GITHUB_STEP_SUMMARY, GITHUB_WORKSPACE: path.resolve(__dirname, '../../../') },
|
|
18
|
+
});
|
|
16
19
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
compareLines(
|
|
20
|
+
test('spwan with reporter', () => {
|
|
21
|
+
assert.strictEqual(child.stderr?.toString(), '');
|
|
22
|
+
compareLines(child.stdout?.toString(), output.stdout);
|
|
23
|
+
compareLines(readFileSync(GITHUB_STEP_SUMMARY).toString(), output.summary);
|
|
24
|
+
});
|
|
20
25
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
assert.strictEqual(silentChild.
|
|
26
|
+
test('should noop if not in github actions', () => {
|
|
27
|
+
const silentChild = spawnSync(process.execPath, ['--test-reporter', './index.js', '../../tests/example'], { env: { } });
|
|
28
|
+
assert.strictEqual(silentChild.stderr?.toString(), '');
|
|
29
|
+
assert.strictEqual(silentChild.stdout?.toString(), '');
|
|
30
|
+
});
|
|
31
|
+
});
|
|
@@ -12,11 +12,15 @@ module.exports = {
|
|
|
12
12
|
::debug::starting to run is ok
|
|
13
13
|
::debug::completed running is ok
|
|
14
14
|
::debug::completed running more tests
|
|
15
|
-
::
|
|
16
|
-
::
|
|
15
|
+
::debug::starting to run is skipped
|
|
16
|
+
::debug::completed running is skipped
|
|
17
|
+
::debug::starting to run is a todo
|
|
18
|
+
::debug::completed running is a todo
|
|
19
|
+
::group::Test results \\(6 passed, 2 failed\\)
|
|
20
|
+
::notice::Total Tests: 4%0APassed ✅: 1%0AFailed ❌: 1%0ACanceled 🚫: 0%0ASkipped ⏭️: 1%0ATodo 📝: 1%0ADuration 🕐: .*ms
|
|
17
21
|
::endgroup::
|
|
18
22
|
`,
|
|
19
23
|
summary: `<h1>Test Results</h1>
|
|
20
|
-
<table><tr><td>Total Tests</td><td>
|
|
24
|
+
<table><tr><td>Total Tests</td><td>4</td></tr><tr><td>Passed ✅</td><td>1</td></tr><tr><td>Failed ❌</td><td>1</td></tr><tr><td>Canceled 🚫</td><td>0</td></tr><tr><td>Skipped ⏭️</td><td>1</td></tr><tr><td>Todo 📝</td><td>1</td></tr><tr><td>Duration 🕐</td><td>.*ms</td></tr></table>
|
|
21
25
|
`,
|
|
22
26
|
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
stdout: `::debug::starting to run tests
|
|
3
|
+
::debug::starting to run is ok
|
|
4
|
+
::debug::completed running is ok
|
|
5
|
+
::debug::starting to run fails
|
|
6
|
+
::error title=fails,file=tests/example.js::\\[Error \\[ERR_TEST_FAILURE\\]: this is an error\\] {%0A failureType: 'testCodeFailure',%0A cause: Error: this is an error%0A at .*.<anonymous> (.*/example.js:6:11).*
|
|
7
|
+
::debug::starting to run is a diagnostic
|
|
8
|
+
::debug::completed running is a diagnostic
|
|
9
|
+
::notice file=tests/example.js::this is a diagnostic
|
|
10
|
+
::error title=tests,file=tests/example.js::\\[Error \\[ERR_TEST_FAILURE\\]: 1 subtest failed\\] { failureType: 'subtestsFailed', cause: '1 subtest failed', code: 'ERR_TEST_FAILURE' }
|
|
11
|
+
::debug::starting to run more tests
|
|
12
|
+
::debug::starting to run is ok
|
|
13
|
+
::debug::completed running is ok
|
|
14
|
+
::debug::completed running more tests
|
|
15
|
+
::debug::starting to run is skipped
|
|
16
|
+
::debug::completed running is skipped
|
|
17
|
+
::debug::starting to run is a todo
|
|
18
|
+
::debug::completed running is a todo
|
|
19
|
+
::group::Test results \\(6 passed, 2 failed\\)
|
|
20
|
+
::notice::Total Tests: 6%0ASuites 📂: 2%0APassed ✅: 3%0AFailed ❌: 1%0ACanceled 🚫: 0%0ASkipped ⏭️: 1%0ATodo 📝: 1%0ADuration 🕐: .*ms
|
|
21
|
+
::endgroup::
|
|
22
|
+
`,
|
|
23
|
+
summary: `<h1>Test Results</h1>
|
|
24
|
+
<table><tr><td>Total Tests</td><td>6</td></tr><tr><td>Suites 📂</td><td>2</td></tr><tr><td>Passed ✅</td><td>3</td></tr><tr><td>Failed ❌</td><td>1</td></tr><tr><td>Canceled 🚫</td><td>0</td></tr><tr><td>Skipped ⏭️</td><td>1</td></tr><tr><td>Todo 📝</td><td>1</td></tr><tr><td>Duration 🕐</td><td>.*ms</td></tr></table>
|
|
25
|
+
`,
|
|
26
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
stdout: `::debug::starting to run tests
|
|
3
|
+
::debug::starting to run is ok
|
|
4
|
+
::debug::completed running is ok
|
|
5
|
+
::debug::starting to run fails
|
|
6
|
+
::error title=fails,file=tests/example.js::\\[Error \\[ERR_TEST_FAILURE\\]: this is an error\\] {%0A failureType: 'testCodeFailure',%0A cause: Error: this is an error%0A at .*.<anonymous> (.*/example.js:6:11).*
|
|
7
|
+
::debug::starting to run is a diagnostic
|
|
8
|
+
::debug::completed running is a diagnostic
|
|
9
|
+
::notice file=tests/example.js::this is a diagnostic
|
|
10
|
+
::error title=tests,file=tests/example.js::\\[Error \\[ERR_TEST_FAILURE\\]: 1 subtest failed\\] { failureType: 'subtestsFailed', cause: '1 subtest failed', code: 'ERR_TEST_FAILURE' }
|
|
11
|
+
::debug::starting to run more tests
|
|
12
|
+
::debug::starting to run is ok
|
|
13
|
+
::debug::completed running is ok
|
|
14
|
+
::debug::completed running more tests
|
|
15
|
+
::debug::starting to run is skipped
|
|
16
|
+
::debug::completed running is skipped
|
|
17
|
+
::debug::starting to run is a todo
|
|
18
|
+
::debug::completed running is a todo
|
|
19
|
+
::group::Test results \\(6 passed, 2 failed\\)
|
|
20
|
+
::notice::Total Tests: 6%0ASuites 📂: 2%0APassed ✅: 3%0AFailed ❌: 1%0ACanceled 🚫: 0%0ASkipped ⏭️: 1%0ATodo 📝: 1%0ADuration 🕐: .*ms
|
|
21
|
+
::endgroup::
|
|
22
|
+
`,
|
|
23
|
+
summary: `<h1>Test Results</h1>
|
|
24
|
+
<table><tr><td>Total Tests</td><td>6</td></tr><tr><td>Suites 📂</td><td>2</td></tr><tr><td>Passed ✅</td><td>3</td></tr><tr><td>Failed ❌</td><td>1</td></tr><tr><td>Canceled 🚫</td><td>0</td></tr><tr><td>Skipped ⏭️</td><td>1</td></tr><tr><td>Todo 📝</td><td>1</td></tr><tr><td>Duration 🕐</td><td>.*ms</td></tr></table>
|
|
25
|
+
`,
|
|
26
|
+
};
|