@reporters/github 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 +8 -0
- package/package.json +7 -3
- package/tests/index.test.js +17 -5
- package/tests/output.js +15 -0
- package/tests/events.js +0 -170
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.0.2](https://github.com/MoLow/reporters/compare/github-v1.0.1...github-v1.0.2) (2022-12-25)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* fix package description ([cec07c7](https://github.com/MoLow/reporters/commit/cec07c70d37b3ed43947b17312a6bd58f095510f))
|
|
9
|
+
* some package.json links ([c51a616](https://github.com/MoLow/reporters/commit/c51a61648e29f5baca539ded1b09c2af3f5e0a4a))
|
|
10
|
+
|
|
3
11
|
## [1.0.1](https://github.com/MoLow/reporters/compare/github-v1.0.0...github-v1.0.1) (2022-12-20)
|
|
4
12
|
|
|
5
13
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reporters/github",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "A
|
|
3
|
+
"version": "1.0.2",
|
|
4
|
+
"description": "A github actions reporter for `node:test`",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"github actions",
|
|
7
7
|
"node:test",
|
|
@@ -14,9 +14,13 @@
|
|
|
14
14
|
"stack-utils": "^2.0.6"
|
|
15
15
|
},
|
|
16
16
|
"scripts": {
|
|
17
|
-
"test": "
|
|
17
|
+
"test": "../../prebuilt --test"
|
|
18
|
+
},
|
|
19
|
+
"bugs": {
|
|
20
|
+
"url": "https://github.com/MoLow/reporters/issues"
|
|
18
21
|
},
|
|
19
22
|
"main": "index.js",
|
|
23
|
+
"homepage": "https://github.com/MoLow/reporters/tree/main/packages/github",
|
|
20
24
|
"repository": "https://github.com/MoLow/reporters.git",
|
|
21
25
|
"author": "Moshe Atlow",
|
|
22
26
|
"license": "MIT"
|
package/tests/index.test.js
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
1
|
+
const { spawnSync } = require('child_process');
|
|
2
|
+
const { tmpdir } = require('os');
|
|
3
|
+
const { join } = require('path');
|
|
4
|
+
const assert = require('assert');
|
|
5
|
+
const { readFileSync, writeFileSync } = require('fs');
|
|
6
|
+
const { compareLines } = require('../../../tests/utils');
|
|
7
|
+
const output = require('./output');
|
|
3
8
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
9
|
+
const GITHUB_STEP_SUMMARY = join(tmpdir(), 'github-actions-test-reporter');
|
|
10
|
+
writeFileSync(GITHUB_STEP_SUMMARY, '');
|
|
11
|
+
|
|
12
|
+
const child = spawnSync(process.execPath, ['--test-reporter', './index.js', '../../tests/example'], {
|
|
13
|
+
env: { GITHUB_STEP_SUMMARY },
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
assert.strictEqual(child.stderr?.toString(), '');
|
|
17
|
+
compareLines(child.stdout?.toString(), output.stdout);
|
|
18
|
+
compareLines(readFileSync(GITHUB_STEP_SUMMARY).toString(), output.summary);
|
package/tests/output.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
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=fails::\\[Error \\[ERR_TEST_FAILURE\\]: this is an error\\] {%0A failureType: 'testCodeFailure',%0A cause: Error: this is an error%0A at Object.<anonymous> (.*/example.js:6:11).*
|
|
7
|
+
::error title=tests::\\[Error \\[ERR_TEST_FAILURE\\]: 1 subtest failed\\] { failureType: 'subtestsFailed', cause: '1 subtest failed', code: 'ERR_TEST_FAILURE' }
|
|
8
|
+
::group::Test results \\(1 passed, 2 failed\\)
|
|
9
|
+
::notice::Total Tests: 1%0APassed ✅: 0%0AFailed ❌: 1%0ACanceled 🚫: 0%0ASkipped ⏭️: 0%0ATodo 📝: 0%0ADuration: .*ms
|
|
10
|
+
::endgroup::
|
|
11
|
+
`,
|
|
12
|
+
summary: `<h1>Test Results</h1>
|
|
13
|
+
<table><tr><td>Total Tests</td><td>1</td></tr><tr><td>Passed ✅</td><td>0</td></tr><tr><td>Failed ❌</td><td>1</td></tr><tr><td>Canceled 🚫</td><td>0</td></tr><tr><td>Skipped ⏭️</td><td>0</td></tr><tr><td>Todo 📝</td><td>0</td></tr><tr><td>Duration</td><td>.*ms</td></tr></table>
|
|
14
|
+
`,
|
|
15
|
+
};
|
package/tests/events.js
DELETED
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
const WORKSPACE = process.env.GITHUB_WORKSPACE ?? '';
|
|
2
|
-
|
|
3
|
-
module.exports = [
|
|
4
|
-
{
|
|
5
|
-
type: 'test:start',
|
|
6
|
-
data: {
|
|
7
|
-
nesting: 0,
|
|
8
|
-
name: `${WORKSPACE}/tests/fixtures/example.js`,
|
|
9
|
-
},
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
type: 'test:start',
|
|
13
|
-
data: {
|
|
14
|
-
nesting: 1,
|
|
15
|
-
name: 'tests',
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
type: 'test:start',
|
|
20
|
-
data: {
|
|
21
|
-
nesting: 2,
|
|
22
|
-
name: 'is ok',
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
type: 'test:pass',
|
|
27
|
-
data: {
|
|
28
|
-
name: 'is ok',
|
|
29
|
-
nesting: 2,
|
|
30
|
-
testNumber: '1',
|
|
31
|
-
details: {
|
|
32
|
-
duration_ms: 0.139292,
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
type: 'test:start',
|
|
38
|
-
data: {
|
|
39
|
-
nesting: 2,
|
|
40
|
-
name: 'fails',
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
type: 'test:fail',
|
|
45
|
-
data: {
|
|
46
|
-
name: 'fails',
|
|
47
|
-
nesting: 2,
|
|
48
|
-
testNumber: '2',
|
|
49
|
-
details: {
|
|
50
|
-
duration_ms: 0.275709,
|
|
51
|
-
error: Object.assign(new Error(''), {
|
|
52
|
-
failureType: 'testCodeFailure',
|
|
53
|
-
cause: {
|
|
54
|
-
code: 'ERR_TEST_FAILURE',
|
|
55
|
-
},
|
|
56
|
-
code: 'ERR_TEST_FAILURE',
|
|
57
|
-
stack: ` at Object.<anonymous> (${WORKSPACE}/tests/fixtures/example.js:6:11)\n at ItTest.runInAsyncScope (node:async_hooks:204:9)\n ... 5 lines matching cause stack trace ...\n at async Suite.run (node:internal/test_runner/test:798:7) {\n failureType: 'testCodeFailure',\n cause: at Object.<anonymous> (${WORKSPACE}/tests/fixtures/example.js:6:11)\n at ItTest.runInAsyncScope (node:async_hooks:204:9)\n at ItTest.run (node:internal/test_runner/test:547:25)\n at Suite.processPendingSubtests (node:internal/test_runner/test:302:27)\n at ItTest.postRun (node:internal/test_runner/test:632:19)\n at ItTest.run (node:internal/test_runner/test:575:10)\n at async Promise.all (index 0)\n at async Suite.run (node:internal/test_runner/test:798:7)`,
|
|
58
|
-
}),
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
type: 'test:plan',
|
|
64
|
-
data: {
|
|
65
|
-
nesting: 2,
|
|
66
|
-
count: 2,
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
type: 'test:fail',
|
|
71
|
-
data: {
|
|
72
|
-
name: 'tests',
|
|
73
|
-
nesting: 1,
|
|
74
|
-
testNumber: '1',
|
|
75
|
-
details: {
|
|
76
|
-
duration_ms: 2.925542,
|
|
77
|
-
error: Object.assign(new Error('1 subtest failed'), {
|
|
78
|
-
failureType: 'subtestsFailed',
|
|
79
|
-
cause: {
|
|
80
|
-
code: 'ERR_TEST_FAILURE',
|
|
81
|
-
},
|
|
82
|
-
code: 'ERR_TEST_FAILURE',
|
|
83
|
-
stack: '',
|
|
84
|
-
}),
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
type: 'test:plan',
|
|
90
|
-
data: {
|
|
91
|
-
nesting: 1,
|
|
92
|
-
count: 1,
|
|
93
|
-
},
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
type: 'test:fail',
|
|
97
|
-
data: {
|
|
98
|
-
name: `${WORKSPACE}/tests/fixtures/example.js`,
|
|
99
|
-
nesting: 0,
|
|
100
|
-
testNumber: 1,
|
|
101
|
-
details: {
|
|
102
|
-
duration_ms: 86.369584,
|
|
103
|
-
error: Object.assign(new Error('test failed'), {
|
|
104
|
-
failureType: 'subtestsFailed',
|
|
105
|
-
cause: 'test failed',
|
|
106
|
-
code: 'ERR_TEST_FAILURE',
|
|
107
|
-
exitCode: 1,
|
|
108
|
-
signal: null,
|
|
109
|
-
stack: '',
|
|
110
|
-
}),
|
|
111
|
-
},
|
|
112
|
-
},
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
type: 'test:plan',
|
|
116
|
-
data: {
|
|
117
|
-
nesting: 0,
|
|
118
|
-
count: 1,
|
|
119
|
-
},
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
type: 'test:diagnostic',
|
|
123
|
-
data: {
|
|
124
|
-
nesting: 0,
|
|
125
|
-
message: 'tests 1',
|
|
126
|
-
},
|
|
127
|
-
},
|
|
128
|
-
{
|
|
129
|
-
type: 'test:diagnostic',
|
|
130
|
-
data: {
|
|
131
|
-
nesting: 0,
|
|
132
|
-
message: 'pass 0',
|
|
133
|
-
},
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
type: 'test:diagnostic',
|
|
137
|
-
data: {
|
|
138
|
-
nesting: 0,
|
|
139
|
-
message: 'fail 1',
|
|
140
|
-
},
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
type: 'test:diagnostic',
|
|
144
|
-
data: {
|
|
145
|
-
nesting: 0,
|
|
146
|
-
message: 'cancelled 0',
|
|
147
|
-
},
|
|
148
|
-
},
|
|
149
|
-
{
|
|
150
|
-
type: 'test:diagnostic',
|
|
151
|
-
data: {
|
|
152
|
-
nesting: 0,
|
|
153
|
-
message: 'skipped 0',
|
|
154
|
-
},
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
type: 'test:diagnostic',
|
|
158
|
-
data: {
|
|
159
|
-
nesting: 0,
|
|
160
|
-
message: 'todo 0',
|
|
161
|
-
},
|
|
162
|
-
},
|
|
163
|
-
{
|
|
164
|
-
type: 'test:diagnostic',
|
|
165
|
-
data: {
|
|
166
|
-
nesting: 0,
|
|
167
|
-
message: 'duration_ms 87.068833',
|
|
168
|
-
},
|
|
169
|
-
},
|
|
170
|
-
];
|