@e2e-dev/github 0.3.0-canary-20260928184528
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/LICENSE +202 -0
- package/NOTICE +5 -0
- package/README.md +32 -0
- package/dist/.build.json +1 -0
- package/dist/actions.d.ts +49 -0
- package/dist/actions.d.ts.map +1 -0
- package/dist/actions.js +91 -0
- package/dist/actions.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/json.d.ts +3 -0
- package/dist/json.d.ts.map +1 -0
- package/dist/json.js +5 -0
- package/dist/json.js.map +1 -0
- package/dist/merge.d.ts +24 -0
- package/dist/merge.d.ts.map +1 -0
- package/dist/merge.js +127 -0
- package/dist/merge.js.map +1 -0
- package/dist/post.d.ts +25 -0
- package/dist/post.d.ts.map +1 -0
- package/dist/post.js +69 -0
- package/dist/post.js.map +1 -0
- package/dist/reporter.d.ts +39 -0
- package/dist/reporter.d.ts.map +1 -0
- package/dist/reporter.js +158 -0
- package/dist/reporter.js.map +1 -0
- package/package.json +65 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/NOTICE
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# @e2e-dev/github
|
|
2
|
+
|
|
3
|
+
The GitHub reporter for [`e2e`](https://www.npmjs.com/package/e2e).
|
|
4
|
+
From GitHub Actions, every run becomes one pull request comment, edited in
|
|
5
|
+
place on reruns, and the same text lands in the job summary.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install --save-dev @e2e-dev/github
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```ts title="e2e.config.ts"
|
|
12
|
+
import type { E2EConfig } from 'e2e';
|
|
13
|
+
import { web } from '@e2e-dev/web';
|
|
14
|
+
import { github } from '@e2e-dev/github';
|
|
15
|
+
|
|
16
|
+
export default {
|
|
17
|
+
targets: [{ engine: web({ url: 'http://localhost:3000' }) }],
|
|
18
|
+
reporters: ['list', github()],
|
|
19
|
+
} satisfies E2EConfig;
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
The job needs `permissions: pull-requests: write` and the step that runs
|
|
23
|
+
`e2e` needs `GITHUB_TOKEN: ${{ github.token }}` in its `env`. Matrix replicas
|
|
24
|
+
of one job pass a `key` so their comments stay apart. When the reporter cannot
|
|
25
|
+
post (another CI, a push, a fork's read-only token) it says why in one summary
|
|
26
|
+
row and never changes the run's exit code.
|
|
27
|
+
|
|
28
|
+
Full documentation lives at [e2e.tester.army/docs/github](https://e2e.tester.army/docs/github).
|
|
29
|
+
|
|
30
|
+
## License
|
|
31
|
+
|
|
32
|
+
Apache-2.0
|
package/dist/.build.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":"0.3.0-canary-20260928184528"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What GitHub Actions tells a job about itself, read from the environment
|
|
3
|
+
* the runner sets: the repository, the pull request the job runs for, the
|
|
4
|
+
* commit to link sources at, the token, and where the job summary is written.
|
|
5
|
+
*
|
|
6
|
+
* The pull request number comes from the event payload first, since
|
|
7
|
+
* `pull_request`, `pull_request_target`, and a PR's `issue_comment` all carry
|
|
8
|
+
* it there, and from `GITHUB_REF` (`refs/pull/N/merge`) when the payload has
|
|
9
|
+
* none. Nothing here is read until the run has finished.
|
|
10
|
+
*/
|
|
11
|
+
export interface ActionsContext {
|
|
12
|
+
/** `owner/repo`. */
|
|
13
|
+
readonly repository: string;
|
|
14
|
+
/** `https://github.com`, or the GitHub Enterprise Server host. */
|
|
15
|
+
readonly serverUrl: string;
|
|
16
|
+
/** `https://api.github.com`, or the Enterprise Server API root. */
|
|
17
|
+
readonly apiUrl: string;
|
|
18
|
+
/** The workflow run page, where uploaded artifacts live. */
|
|
19
|
+
readonly runUrl: string;
|
|
20
|
+
readonly eventName: string;
|
|
21
|
+
readonly workflow: string;
|
|
22
|
+
readonly job: string;
|
|
23
|
+
/**
|
|
24
|
+
* The commit sources are linked at: the pull request's head when the event
|
|
25
|
+
* payload names it, the checked-out SHA when the event is not about a pull
|
|
26
|
+
* request, and nothing on an `issue_comment`, whose SHA is the default
|
|
27
|
+
* branch and would link every source line to the wrong revision.
|
|
28
|
+
*/
|
|
29
|
+
readonly sha: string | undefined;
|
|
30
|
+
readonly pullRequest: number | undefined;
|
|
31
|
+
/** `GITHUB_TOKEN`, or `GH_TOKEN` the way the `gh` CLI reads it. */
|
|
32
|
+
readonly token: string | undefined;
|
|
33
|
+
/** The file `GITHUB_STEP_SUMMARY` names, when the runner provides one. */
|
|
34
|
+
readonly stepSummaryPath: string | undefined;
|
|
35
|
+
/** `GITHUB_WORKSPACE`, the checkout root the repository's paths are relative to. */
|
|
36
|
+
readonly workspace: string | undefined;
|
|
37
|
+
}
|
|
38
|
+
export interface ActionsDeps {
|
|
39
|
+
readonly env: NodeJS.ProcessEnv;
|
|
40
|
+
readonly readFile: (file: string) => Promise<string>;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* The Actions context of the current job, or undefined outside GitHub
|
|
44
|
+
* Actions. On Actions the runner always sets the repository, run id, event
|
|
45
|
+
* name, workflow, and job; a job missing one is broken, not "not Actions",
|
|
46
|
+
* and says so.
|
|
47
|
+
*/
|
|
48
|
+
export declare function detectActions(deps: ActionsDeps): Promise<ActionsContext | undefined>;
|
|
49
|
+
//# sourceMappingURL=actions.d.ts.map
|
|
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about itself, read from the environment
|
|
3
|
+
* the runner sets: the repository, the pull request the job runs for, the
|
|
4
|
+
* commit to link sources at, the token, and where the job summary is written.
|
|
5
|
+
*
|
|
6
|
+
* The pull request number comes from the event payload first, since
|
|
7
|
+
* `pull_request`, `pull_request_target`, and a PR's `issue_comment` all carry
|
|
8
|
+
* it there, and from `GITHUB_REF` (`refs/pull/N/merge`) when the payload has
|
|
9
|
+
* none. Nothing here is read until the run has finished.
|
|
10
|
+
*/
|
|
11
|
+
import { isRecord } from './json.js';
|
|
12
|
+
/** A variable's trimmed value; unset and blank both read as undefined. */
|
|
13
|
+
function envValue(env, name) {
|
|
14
|
+
const raw = env[name];
|
|
15
|
+
return raw === undefined || raw.trim() === '' ? undefined : raw.trim();
|
|
16
|
+
}
|
|
17
|
+
function pullRequestNumber(value) {
|
|
18
|
+
return typeof value === 'number' && Number.isInteger(value) && value > 0 ? value : undefined;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Reads the pull request out of the webhook payload, or nothing when the
|
|
22
|
+
* payload is missing, unreadable, or not about a pull request.
|
|
23
|
+
*/
|
|
24
|
+
async function readEvent(path, deps) {
|
|
25
|
+
if (path === undefined)
|
|
26
|
+
return undefined;
|
|
27
|
+
let payload;
|
|
28
|
+
try {
|
|
29
|
+
payload = JSON.parse(await deps.readFile(path));
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
|
+
if (!isRecord(payload))
|
|
35
|
+
return undefined;
|
|
36
|
+
const pull = payload['pull_request'];
|
|
37
|
+
if (isRecord(pull)) {
|
|
38
|
+
const head = pull['head'];
|
|
39
|
+
return {
|
|
40
|
+
number: pullRequestNumber(pull['number']),
|
|
41
|
+
headSha: isRecord(head) && typeof head['sha'] === 'string' ? head['sha'] : undefined,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
// An `issue_comment` on a pull request: the issue carries a `pull_request`
|
|
45
|
+
// link but not the head commit, and GITHUB_SHA is the default branch here.
|
|
46
|
+
const issue = payload['issue'];
|
|
47
|
+
if (isRecord(issue) && isRecord(issue['pull_request'])) {
|
|
48
|
+
return { number: pullRequestNumber(issue['number']), headSha: undefined };
|
|
49
|
+
}
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
/** The number in `refs/pull/N/merge` or `refs/pull/N/head`. */
|
|
53
|
+
function pullFromRef(ref) {
|
|
54
|
+
const match = ref === undefined ? null : /^refs\/pull\/(\d+)\//.exec(ref);
|
|
55
|
+
return match === null ? undefined : pullRequestNumber(Number(match[1]));
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* The Actions context of the current job, or undefined outside GitHub
|
|
59
|
+
* Actions. On Actions the runner always sets the repository, run id, event
|
|
60
|
+
* name, workflow, and job; a job missing one is broken, not "not Actions",
|
|
61
|
+
* and says so.
|
|
62
|
+
*/
|
|
63
|
+
export async function detectActions(deps) {
|
|
64
|
+
const value = (name) => envValue(deps.env, name);
|
|
65
|
+
if (value('GITHUB_ACTIONS') === undefined)
|
|
66
|
+
return undefined;
|
|
67
|
+
const required = (name) => {
|
|
68
|
+
const found = value(name);
|
|
69
|
+
if (found === undefined)
|
|
70
|
+
throw new Error(`GITHUB_ACTIONS is set but ${name} is not`);
|
|
71
|
+
return found;
|
|
72
|
+
};
|
|
73
|
+
const repository = required('GITHUB_REPOSITORY');
|
|
74
|
+
const serverUrl = (value('GITHUB_SERVER_URL') ?? 'https://github.com').replace(/\/+$/, '');
|
|
75
|
+
const event = await readEvent(value('GITHUB_EVENT_PATH'), deps);
|
|
76
|
+
return {
|
|
77
|
+
repository,
|
|
78
|
+
serverUrl,
|
|
79
|
+
apiUrl: (value('GITHUB_API_URL') ?? 'https://api.github.com').replace(/\/+$/, ''),
|
|
80
|
+
runUrl: `${serverUrl}/${repository}/actions/runs/${required('GITHUB_RUN_ID')}`,
|
|
81
|
+
eventName: required('GITHUB_EVENT_NAME'),
|
|
82
|
+
workflow: required('GITHUB_WORKFLOW'),
|
|
83
|
+
job: required('GITHUB_JOB'),
|
|
84
|
+
sha: event === undefined ? value('GITHUB_SHA') : event.headSha,
|
|
85
|
+
pullRequest: event?.number ?? pullFromRef(value('GITHUB_REF')),
|
|
86
|
+
token: value('GITHUB_TOKEN') ?? value('GH_TOKEN'),
|
|
87
|
+
stepSummaryPath: value('GITHUB_STEP_SUMMARY'),
|
|
88
|
+
workspace: value('GITHUB_WORKSPACE'),
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=actions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.js","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAmCrC,0EAA0E;AAC1E,SAAS,QAAQ,CAAC,GAAsB,EAAE,IAAY;IACpD,MAAM,GAAG,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC;IACtB,OAAO,GAAG,KAAK,SAAS,IAAI,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;AACzE,CAAC;AAQD,SAAS,iBAAiB,CAAC,KAAc;IACvC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AAC/F,CAAC;AAED;;;GAGG;AACH,KAAK,UAAU,SAAS,CAAC,IAAwB,EAAE,IAAiB;IAClE,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IACzC,IAAI,OAAgB,CAAC;IACrB,IAAI,CAAC;QACH,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC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,CAAC,OAAO;QAC9D,WAAW,EAAE,KAAK,EAAE,MAAM,IAAI,WAAW,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;QAC9D,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC;QACjD,eAAe,EAAE,KAAK,CAAC,qBAAqB,CAAC;QAC7C,SAAS,EAAE,KAAK,CAAC,kBAAkB,CAAC;KACrC,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@e2e-dev/github` public surface: the `github()` reporter factory. The
|
|
3
|
+
* reporter posts one pull request comment per run from GitHub Actions,
|
|
4
|
+
* through the `reporters` seam of `e2e`, and writes the same text to
|
|
5
|
+
* the job summary. The page itself is `renderMarkdownReport` from `e2e`.
|
|
6
|
+
*/
|
|
7
|
+
export { github } from './reporter.ts';
|
|
8
|
+
export type { GitHubOptions } from './reporter.ts';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@e2e-dev/github` public surface: the `github()` reporter factory. The
|
|
3
|
+
* reporter posts one pull request comment per run from GitHub Actions,
|
|
4
|
+
* through the `reporters` seam of `e2e`, and writes the same text to
|
|
5
|
+
* the job summary. The page itself is `renderMarkdownReport` from `e2e`.
|
|
6
|
+
*/
|
|
7
|
+
export { github } from './reporter.js';
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/json.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../src/json.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEzE"}
|
package/dist/json.js
ADDED
package/dist/json.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json.js","sourceRoot":"","sources":["../src/json.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,MAAM,UAAU,QAAQ,CAAC,KAAc;IACrC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC"}
|
package/dist/merge.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A `--last-failed` rerun and the run it selected from, as one report. The
|
|
3
|
+
* rerun's document lists every test the run before it passed as unselected,
|
|
4
|
+
* so the page would show only the few tests it ran again; folding the two
|
|
5
|
+
* gives the comment the whole suite: carried results for the tests the rerun
|
|
6
|
+
* left out, the rerun's results for the rest, and a test that failed and then
|
|
7
|
+
* passed reads as flaky with both runs' attempts. Rendering only: nothing
|
|
8
|
+
* here is written back to a report file.
|
|
9
|
+
*/
|
|
10
|
+
import type { Report } from 'e2e';
|
|
11
|
+
/**
|
|
12
|
+
* The rerun folded into the run it selected from. A result the rerun has
|
|
13
|
+
* under the same id is folded with it; a test the rerun left out keeps what
|
|
14
|
+
* the run before said. Results the rerun has no id for at all, the further
|
|
15
|
+
* repeats of a `--repeat-each` first pass a plain rerun ran once, fold into
|
|
16
|
+
* the rerun's first result of that test, or stay as carried rows when the
|
|
17
|
+
* rerun left the test out. A run before of another project leaves the rerun
|
|
18
|
+
* as it is. The outcome is the rerun's unless a carried result failed, as a
|
|
19
|
+
* test another filter kept out of the rerun can have: then the page is red,
|
|
20
|
+
* since it lists a failure. The start is the run before's, so the footer's
|
|
21
|
+
* duration spans both.
|
|
22
|
+
*/
|
|
23
|
+
export declare function foldLastRun(current: Report, lastRun: Report): Report;
|
|
24
|
+
//# sourceMappingURL=merge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../src/merge.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAyDlC;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAiDpE"}
|
package/dist/merge.js
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A `--last-failed` rerun and the run it selected from, as one report. The
|
|
3
|
+
* rerun's document lists every test the run before it passed as unselected,
|
|
4
|
+
* so the page would show only the few tests it ran again; folding the two
|
|
5
|
+
* gives the comment the whole suite: carried results for the tests the rerun
|
|
6
|
+
* left out, the rerun's results for the rest, and a test that failed and then
|
|
7
|
+
* passed reads as flaky with both runs' attempts. Rendering only: nothing
|
|
8
|
+
* here is written back to a report file.
|
|
9
|
+
*/
|
|
10
|
+
/** Statuses that count as a failure of the run, the ones `--last-failed` runs again. */
|
|
11
|
+
const FAILED_STATUSES = new Set(['failed', 'timed-out', 'interrupted']);
|
|
12
|
+
/**
|
|
13
|
+
* A test per target and agent, whatever its `--repeat-each` run: the identity
|
|
14
|
+
* `--last-failed` selects by, so a rerun without the flag runs once a test any
|
|
15
|
+
* repeat of which failed.
|
|
16
|
+
*/
|
|
17
|
+
function testKey(result) {
|
|
18
|
+
return [result.testId, result.targetId, result.agent].join('\u0000');
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The rerun's result with the run before's attempts in front of its own:
|
|
22
|
+
* the same test's result there, and the further repeats the rerun has no
|
|
23
|
+
* result of its own for. A pass after a failure there is flaky.
|
|
24
|
+
*/
|
|
25
|
+
function foldRerun(current, history) {
|
|
26
|
+
if (history.length === 0)
|
|
27
|
+
return current;
|
|
28
|
+
const before = history.toSorted((a, b) => a.repeat - b.repeat);
|
|
29
|
+
const attempts = [...before.flatMap((result) => result.attempts), ...current.attempts];
|
|
30
|
+
const status = current.status === 'passed' && before.some((result) => FAILED_STATUSES.has(result.status)) ? 'flaky' : current.status;
|
|
31
|
+
return { ...current, status, attempts };
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* A serial group the rerun ran again, with the run before's attempts in front
|
|
35
|
+
* of its own: a member's history is read off its group, so the first pass's
|
|
36
|
+
* failure stays visible under a member that passed on the rerun.
|
|
37
|
+
*/
|
|
38
|
+
function foldGroup(current, before) {
|
|
39
|
+
if (before === undefined)
|
|
40
|
+
return current;
|
|
41
|
+
const attempts = [...before.attempts, ...current.attempts].map((attempt, index) => ({ ...attempt, index }));
|
|
42
|
+
return { ...current, attempts };
|
|
43
|
+
}
|
|
44
|
+
/** The counts the way the runner tallies them, over the folded results. */
|
|
45
|
+
function summarize(results, base) {
|
|
46
|
+
const summary = { ...base, discovered: results.length, selected: 0, executed: 0, passed: 0, failed: 0, flaky: 0, skipped: 0 };
|
|
47
|
+
for (const result of results) {
|
|
48
|
+
if (result.selected)
|
|
49
|
+
summary.selected += 1;
|
|
50
|
+
if (result.attempts.length > 0 || (result.serialGroupId !== undefined && result.status !== 'skipped'))
|
|
51
|
+
summary.executed += 1;
|
|
52
|
+
if (result.status === 'passed')
|
|
53
|
+
summary.passed += 1;
|
|
54
|
+
else if (result.status === 'flaky')
|
|
55
|
+
summary.flaky += 1;
|
|
56
|
+
else if (FAILED_STATUSES.has(result.status))
|
|
57
|
+
summary.failed += 1;
|
|
58
|
+
else
|
|
59
|
+
summary.skipped += 1;
|
|
60
|
+
}
|
|
61
|
+
return summary;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* The rerun folded into the run it selected from. A result the rerun has
|
|
65
|
+
* under the same id is folded with it; a test the rerun left out keeps what
|
|
66
|
+
* the run before said. Results the rerun has no id for at all, the further
|
|
67
|
+
* repeats of a `--repeat-each` first pass a plain rerun ran once, fold into
|
|
68
|
+
* the rerun's first result of that test, or stay as carried rows when the
|
|
69
|
+
* rerun left the test out. A run before of another project leaves the rerun
|
|
70
|
+
* as it is. The outcome is the rerun's unless a carried result failed, as a
|
|
71
|
+
* test another filter kept out of the rerun can have: then the page is red,
|
|
72
|
+
* since it lists a failure. The start is the run before's, so the footer's
|
|
73
|
+
* duration spans both.
|
|
74
|
+
*/
|
|
75
|
+
export function foldLastRun(current, lastRun) {
|
|
76
|
+
if (lastRun.run.project.id !== current.run.project.id)
|
|
77
|
+
return current;
|
|
78
|
+
const currentIds = new Set(current.run.results.map((result) => result.id));
|
|
79
|
+
const beforeById = new Map(lastRun.run.results.map((result) => [result.id, result]));
|
|
80
|
+
const leftovers = new Map();
|
|
81
|
+
for (const result of lastRun.run.results) {
|
|
82
|
+
if (currentIds.has(result.id))
|
|
83
|
+
continue;
|
|
84
|
+
const key = testKey(result);
|
|
85
|
+
leftovers.set(key, [...(leftovers.get(key) ?? []), result]);
|
|
86
|
+
}
|
|
87
|
+
const firstOfKey = new Map();
|
|
88
|
+
for (const result of current.run.results.toSorted((a, b) => a.repeat - b.repeat)) {
|
|
89
|
+
if (!firstOfKey.has(testKey(result)))
|
|
90
|
+
firstOfKey.set(testKey(result), result.id);
|
|
91
|
+
}
|
|
92
|
+
const results = [];
|
|
93
|
+
for (const result of current.run.results) {
|
|
94
|
+
const before = beforeById.get(result.id);
|
|
95
|
+
if (!result.selected) {
|
|
96
|
+
results.push(before ?? result);
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
const key = testKey(result);
|
|
100
|
+
const extra = firstOfKey.get(key) === result.id ? (leftovers.get(key) ?? []) : [];
|
|
101
|
+
if (extra.length > 0)
|
|
102
|
+
leftovers.delete(key);
|
|
103
|
+
results.push(foldRerun(result, before === undefined ? extra : [before, ...extra]));
|
|
104
|
+
}
|
|
105
|
+
for (const extra of leftovers.values())
|
|
106
|
+
results.push(...extra);
|
|
107
|
+
const beforeGroups = new Map(lastRun.run.serialGroups.map((group) => [group.id, group]));
|
|
108
|
+
const currentGroupIds = new Set(current.run.serialGroups.map((group) => group.id));
|
|
109
|
+
const serialGroups = [
|
|
110
|
+
...lastRun.run.serialGroups.filter((group) => !currentGroupIds.has(group.id)),
|
|
111
|
+
...current.run.serialGroups.map((group) => foldGroup(group, beforeGroups.get(group.id))),
|
|
112
|
+
];
|
|
113
|
+
const carriedFailure = results.some((result) => result.selected && FAILED_STATUSES.has(result.status));
|
|
114
|
+
return {
|
|
115
|
+
...current,
|
|
116
|
+
run: {
|
|
117
|
+
...current.run,
|
|
118
|
+
status: carriedFailure && current.run.status === 'passed' ? 'failed' : current.run.status,
|
|
119
|
+
exitCode: carriedFailure && current.run.exitCode === 0 ? 1 : current.run.exitCode,
|
|
120
|
+
startedAt: lastRun.run.startedAt,
|
|
121
|
+
serialGroups,
|
|
122
|
+
results,
|
|
123
|
+
summary: summarize(results, current.run.summary),
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=merge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge.js","sourceRoot":"","sources":["../src/merge.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AASH,wFAAwF;AACxF,MAAM,eAAe,GAAG,IAAI,GAAG,CAAyB,CAAC,QAAQ,EAAE,WAAW,EAAE,aAAa,CAAC,CAAC,CAAC;AAEhG;;;;GAIG;AACH,SAAS,OAAO,CAAC,MAAoB;IACnC,OAAO,CAA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AC,YAAY,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAC7E,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,SAAS,CAAC,KAAK,EAAE,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;KACzF,CAAC;IAEF,MAAM,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,IAAI,eAAe,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IACvG,OAAO;QACL,GAAG,OAAO;QACV,GAAG,EAAE;YACH,GAAG,OAAO,CAAC,GAAG;YACd,MAAM,EAAE,cAAc,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM;YACzF,QAAQ,EAAE,cAAc,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ;YACjF,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,SAAS;YAChC,YAAY;YACZ,OAAO;YACP,OAAO,EAAE,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC;SACjD;KACF,CAAC;AACJ,CAAC"}
|
package/dist/post.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One comment per pull request, kept current: the reporter looks for the
|
|
3
|
+
* comment carrying its marker and edits it, and creates one only when none
|
|
4
|
+
* exists. The REST calls are the three GitHub documents them as: list the
|
|
5
|
+
* issue's comments, update a comment, create a comment.
|
|
6
|
+
*
|
|
7
|
+
* Every request carries the reporter's abort signal. Anything GitHub answers
|
|
8
|
+
* outside the protocol is an error naming itself; the runner prints one line.
|
|
9
|
+
*/
|
|
10
|
+
export interface PostParams {
|
|
11
|
+
readonly fetch: typeof fetch;
|
|
12
|
+
readonly signal: AbortSignal;
|
|
13
|
+
/** `https://api.github.com`, or an Enterprise Server API root. */
|
|
14
|
+
readonly apiUrl: string;
|
|
15
|
+
readonly token: string;
|
|
16
|
+
/** `owner/repo`. */
|
|
17
|
+
readonly repository: string;
|
|
18
|
+
readonly pullRequest: number;
|
|
19
|
+
/** The hidden HTML comment that identifies the reporter's own comment. */
|
|
20
|
+
readonly marker: string;
|
|
21
|
+
readonly body: string;
|
|
22
|
+
}
|
|
23
|
+
/** Creates or updates the reporter's comment and resolves with its URL. */
|
|
24
|
+
export declare function upsertComment(params: PostParams): Promise<string>;
|
|
25
|
+
//# sourceMappingURL=post.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"post.d.ts","sourceRoot":"","sources":["../src/post.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,KAAK,EAAE,OAAO,KAAK,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,kEAAkE;IAClE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,oBAAoB;IACpB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,0EAA0E;IAC1E,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAqDD,2EAA2E;AAC3E,wBAAsB,aAAa,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAWvE"}
|
package/dist/post.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One comment per pull request, kept current: the reporter looks for the
|
|
3
|
+
* comment carrying its marker and edits it, and creates one only when none
|
|
4
|
+
* exists. The REST calls are the three GitHub documents them as: list the
|
|
5
|
+
* issue's comments, update a comment, create a comment.
|
|
6
|
+
*
|
|
7
|
+
* Every request carries the reporter's abort signal. Anything GitHub answers
|
|
8
|
+
* outside the protocol is an error naming itself; the runner prints one line.
|
|
9
|
+
*/
|
|
10
|
+
import { isRecord } from './json.js';
|
|
11
|
+
const PER_PAGE = 100;
|
|
12
|
+
/**
|
|
13
|
+
* The list is followed until a short page says it is exhausted. The cap is a
|
|
14
|
+
* guard against a server that never sends one, not a limit any pull request
|
|
15
|
+
* reaches: ten thousand comments.
|
|
16
|
+
*/
|
|
17
|
+
const MAX_PAGES = 100;
|
|
18
|
+
const USER_AGENT = '@e2e-dev/github';
|
|
19
|
+
/** One GitHub REST call; anything but success is an error the runner can print. */
|
|
20
|
+
async function request(params, method, route, body) {
|
|
21
|
+
const response = await params.fetch(`${params.apiUrl}${route}`, {
|
|
22
|
+
method,
|
|
23
|
+
headers: {
|
|
24
|
+
authorization: `Bearer ${params.token}`,
|
|
25
|
+
accept: 'application/vnd.github+json',
|
|
26
|
+
'x-github-api-version': '2022-11-28',
|
|
27
|
+
'user-agent': USER_AGENT,
|
|
28
|
+
...(body === undefined ? {} : { 'content-type': 'application/json' }),
|
|
29
|
+
},
|
|
30
|
+
...(body === undefined ? {} : { body: JSON.stringify(body) }),
|
|
31
|
+
signal: params.signal,
|
|
32
|
+
});
|
|
33
|
+
if (response.ok)
|
|
34
|
+
return response.json().catch(() => undefined);
|
|
35
|
+
const detail = (await response.text().catch(() => '')).slice(0, 200);
|
|
36
|
+
if (response.status === 401)
|
|
37
|
+
throw new Error('GitHub rejected the token (GITHUB_TOKEN or GH_TOKEN)');
|
|
38
|
+
if (response.status === 403 || response.status === 404) {
|
|
39
|
+
throw new Error(`the token cannot comment on ${params.repository}#${params.pullRequest}: a pull request from a fork runs with a read-only token, and the job needs \`permissions: pull-requests: write\``);
|
|
40
|
+
}
|
|
41
|
+
throw new Error(`GitHub responded ${response.status} to ${method} ${route}${detail === '' ? '' : `: ${detail}`}`);
|
|
42
|
+
}
|
|
43
|
+
/** The id of the comment carrying the marker, or undefined when no page has one. */
|
|
44
|
+
async function findComment(params, issue) {
|
|
45
|
+
for (let page = 1; page <= MAX_PAGES; page += 1) {
|
|
46
|
+
const comments = await request(params, 'GET', `${issue}/comments?per_page=${PER_PAGE}&page=${page}`);
|
|
47
|
+
if (!Array.isArray(comments))
|
|
48
|
+
throw new Error('GitHub answered the comment list with a body that is not a list');
|
|
49
|
+
const found = comments.find((comment) => isRecord(comment) && typeof comment['body'] === 'string' && comment['body'].includes(params.marker));
|
|
50
|
+
if (isRecord(found) && typeof found['id'] === 'number')
|
|
51
|
+
return found['id'];
|
|
52
|
+
if (comments.length < PER_PAGE)
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
/** Creates or updates the reporter's comment and resolves with its URL. */
|
|
58
|
+
export async function upsertComment(params) {
|
|
59
|
+
const issue = `/repos/${params.repository}/issues/${params.pullRequest}`;
|
|
60
|
+
const existing = await findComment(params, issue);
|
|
61
|
+
const created = existing === undefined
|
|
62
|
+
? await request(params, 'POST', `${issue}/comments`, { body: params.body })
|
|
63
|
+
: await request(params, 'PATCH', `/repos/${params.repository}/issues/comments/${existing}`, { body: params.body });
|
|
64
|
+
if (!isRecord(created) || typeof created['html_url'] !== 'string') {
|
|
65
|
+
throw new Error('GitHub answered the comment without its html_url');
|
|
66
|
+
}
|
|
67
|
+
return created['html_url'];
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=post.js.map
|
package/dist/post.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"post.js","sourceRoot":"","sources":["../src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G,QAAQ;YAAE,OAAO,SAAS,CAAC;IACnD,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,2EAA2E;AAC3E,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,MAAkB;IACpD,MAAM,KAAK,GAAG,UAAU,MAAM,CAAC,UAAU,WAAW,MAAM,CAAC,WAAW,EAAE,CAAC;IACzE,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAClD,MAAM,OAAO,GACX,QAAQ,KAAK,SAAS;QACpB,CAAC,CAAC,MAAM,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,WAAW,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;QAC3E,CAAC,CAAC,MAAM,OAAO,CAAC,MAAM,EAAE,OAAO,EAAE,UAAU,MAAM,CAAC,UAAU,oBAAoB,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;IACvH,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,OAAO,OAAO,CAAC,UAAU,CAAC,KAAK,QAAQ,EAAE,CAAC;QAClE,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;IACtE,CAAC;IACD,OAAO,OAAO,CAAC,UAAU,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type FinishedRun, type Reporter, type ReporterSummary } from 'e2e';
|
|
2
|
+
import { type ActionsDeps } from './actions.ts';
|
|
3
|
+
export interface GitHubOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Tells one job's comment apart from another's when the workflow, job, and
|
|
6
|
+
* project are the same, as in a matrix: `key: process.env.MATRIX_BROWSER`.
|
|
7
|
+
* Without it, matrix replicas of one job share a comment and the last one
|
|
8
|
+
* to finish wins. Never the run id: a rerun must find the old comment. The
|
|
9
|
+
* key is also the comment's name in its headline: `e2e chromium: 77 passed`.
|
|
10
|
+
*/
|
|
11
|
+
key?: string;
|
|
12
|
+
}
|
|
13
|
+
/** What the reporter touches outside itself, so tests run it against fakes. */
|
|
14
|
+
export interface ReportDeps extends ActionsDeps {
|
|
15
|
+
readonly fetch: typeof fetch;
|
|
16
|
+
readonly appendFile: (file: string, text: string) => Promise<void>;
|
|
17
|
+
/** Whether a path exists; the checkout root is the directory that holds `.git`. */
|
|
18
|
+
readonly exists: (file: string) => boolean;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The GitHub reporter. Add it to `reporters` beside the built-in ids:
|
|
22
|
+
*
|
|
23
|
+
* ```ts
|
|
24
|
+
* import { github } from '@e2e-dev/github';
|
|
25
|
+
* export default { targets, reporters: ['list', github()] } satisfies E2EConfig;
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* On GitHub Actions it writes the run to the job summary and, for a pull
|
|
29
|
+
* request, posts or updates one comment. A `--last-failed` rerun updates it
|
|
30
|
+
* as one run: the tests the rerun left out keep the results of the run it
|
|
31
|
+
* selected from, and a test that failed and then passed reads as flaky.
|
|
32
|
+
* Everything it reads (the token, the event, the repository) is read when the
|
|
33
|
+
* run finishes, never when the config loads, so constructing it has no side
|
|
34
|
+
* effects.
|
|
35
|
+
*/
|
|
36
|
+
export declare function github(options?: GitHubOptions): Reporter;
|
|
37
|
+
/** Reports one finished run and resolves with the summary rows describing what happened. */
|
|
38
|
+
export declare function reportRun(run: FinishedRun, signal: AbortSignal, options: GitHubOptions, deps: ReportDeps): Promise<ReporterSummary>;
|
|
39
|
+
//# sourceMappingURL=reporter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reporter.d.ts","sourceRoot":"","sources":["../src/reporter.ts"],"names":[],"mappings":"AAGA,OAAO,EAAwB,KAAK,WAAW,EAA8B,KAAK,QAAQ,EAAE,KAAK,eAAe,EAAE,MAAM,KAAK,CAAC;AAC9H,OAAO,EAAsC,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAMpF,MAAM,WAAW,aAAa;IAC5B;;;;;;OAMG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,+EAA+E;AAC/E,MAAM,WAAW,UAAW,SAAQ,WAAW;IAC7C,QAAQ,CAAC,KAAK,EAAE,OAAO,KAAK,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACnE,mFAAmF;IACnF,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;CAC5C;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,MAAM,CAAC,OAAO,GAAE,aAAkB,GAAG,QAAQ,CAY5D;AA+FD,4FAA4F;AAC5F,wBAAsB,SAAS,CAC7B,GAAG,EAAE,WAAW,EAChB,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,aAAa,EACtB,IAAI,EAAE,UAAU,GACf,OAAO,CAAC,eAAe,CAAC,CAmC1B"}
|
package/dist/reporter.js
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
2
|
+
import { appendFile, readFile } from 'node:fs/promises';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { renderMarkdownReport } from 'e2e';
|
|
5
|
+
import { detectActions } from './actions.js';
|
|
6
|
+
import { foldLastRun } from './merge.js';
|
|
7
|
+
import { upsertComment } from './post.js';
|
|
8
|
+
const SUMMARY_LABEL = 'GitHub';
|
|
9
|
+
/**
|
|
10
|
+
* The GitHub reporter. Add it to `reporters` beside the built-in ids:
|
|
11
|
+
*
|
|
12
|
+
* ```ts
|
|
13
|
+
* import { github } from '@e2e-dev/github';
|
|
14
|
+
* export default { targets, reporters: ['list', github()] } satisfies E2EConfig;
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* On GitHub Actions it writes the run to the job summary and, for a pull
|
|
18
|
+
* request, posts or updates one comment. A `--last-failed` rerun updates it
|
|
19
|
+
* as one run: the tests the rerun left out keep the results of the run it
|
|
20
|
+
* selected from, and a test that failed and then passed reads as flaky.
|
|
21
|
+
* Everything it reads (the token, the event, the repository) is read when the
|
|
22
|
+
* run finishes, never when the config loads, so constructing it has no side
|
|
23
|
+
* effects.
|
|
24
|
+
*/
|
|
25
|
+
export function github(options = {}) {
|
|
26
|
+
return {
|
|
27
|
+
name: 'github',
|
|
28
|
+
onRunFinished: (run, signal) => reportRun(run, signal, options, {
|
|
29
|
+
fetch: globalThis.fetch,
|
|
30
|
+
env: process.env,
|
|
31
|
+
readFile: (file) => readFile(file, 'utf8'),
|
|
32
|
+
appendFile: (file, text) => appendFile(file, text, 'utf8'),
|
|
33
|
+
exists: existsSync,
|
|
34
|
+
}),
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Each encoded marker field is cut to this many characters, so four fields
|
|
39
|
+
* and their names stay under a kilobyte whatever the input, well inside the
|
|
40
|
+
* room the page leaves under GitHub's size limit. The cut
|
|
41
|
+
* never lands inside a percent escape, and it is the same on every run.
|
|
42
|
+
*/
|
|
43
|
+
const MAX_MARKER_FIELD_CHARS = 200;
|
|
44
|
+
function markerField(value) {
|
|
45
|
+
const encoded = encodeURIComponent(value);
|
|
46
|
+
if (encoded.length <= MAX_MARKER_FIELD_CHARS)
|
|
47
|
+
return encoded;
|
|
48
|
+
return encoded.slice(0, MAX_MARKER_FIELD_CHARS).replace(/%[0-9A-F]?$/, '');
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The marker one job's comment carries, so two workflows or jobs each keep
|
|
52
|
+
* their own. Every field is cut the same way on every run, so a rerun
|
|
53
|
+
* derives the same marker and finds its comment.
|
|
54
|
+
*/
|
|
55
|
+
function commentMarker(run, context, key) {
|
|
56
|
+
const fields = {
|
|
57
|
+
project: run.report.run.project.id,
|
|
58
|
+
workflow: context.workflow,
|
|
59
|
+
job: context.job,
|
|
60
|
+
key,
|
|
61
|
+
};
|
|
62
|
+
const parts = Object.entries(fields).flatMap(([name, value]) => value === undefined || value === '' ? [] : [`${name}=${markerField(value)}`]);
|
|
63
|
+
return `<!-- e2e-github ${parts.join(' ')} -->`;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* The directory the repository is checked out in: the nearest ancestor of the
|
|
67
|
+
* project root, itself included, that holds `.git`. `actions/checkout` puts
|
|
68
|
+
* it at `GITHUB_WORKSPACE` unless its `path` input names a subdirectory, so
|
|
69
|
+
* the workspace bounds the walk and stands in when no `.git` is found.
|
|
70
|
+
*/
|
|
71
|
+
function checkoutRoot(workspace, projectRoot, exists) {
|
|
72
|
+
let dir = projectRoot;
|
|
73
|
+
while (dir.startsWith(workspace)) {
|
|
74
|
+
if (exists(path.join(dir, '.git')))
|
|
75
|
+
return dir;
|
|
76
|
+
const parent = path.dirname(dir);
|
|
77
|
+
if (parent === dir)
|
|
78
|
+
break;
|
|
79
|
+
dir = parent;
|
|
80
|
+
}
|
|
81
|
+
return workspace;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* The project's path inside the checkout, as segments. The report's files are
|
|
85
|
+
* relative to the project root, and a suite that lives in `packages/e2e-tests`
|
|
86
|
+
* links to `blob/<sha>/packages/e2e-tests/tests/...`. A project at the
|
|
87
|
+
* checkout root, or one outside it, adds nothing.
|
|
88
|
+
*/
|
|
89
|
+
function projectSegments(workspace, projectRoot, exists) {
|
|
90
|
+
if (workspace === undefined)
|
|
91
|
+
return [];
|
|
92
|
+
const relative = path.relative(checkoutRoot(workspace, projectRoot, exists), projectRoot);
|
|
93
|
+
if (relative === '' || relative === '..' || relative.startsWith(`..${path.sep}`) || path.isAbsolute(relative))
|
|
94
|
+
return [];
|
|
95
|
+
return relative.split(path.sep);
|
|
96
|
+
}
|
|
97
|
+
function sourceUrl(context, projectRoot, deps) {
|
|
98
|
+
const sha = context.sha;
|
|
99
|
+
if (sha === undefined)
|
|
100
|
+
return undefined;
|
|
101
|
+
const prefix = projectSegments(context.workspace, projectRoot, deps.exists);
|
|
102
|
+
return (file, line) => `${context.serverUrl}/${context.repository}/blob/${sha}/${[...prefix, ...file.split('/')].map(encodeURIComponent).join('/')}#L${line}`;
|
|
103
|
+
}
|
|
104
|
+
function posting(context) {
|
|
105
|
+
if (context.pullRequest === undefined)
|
|
106
|
+
return { skipped: `${context.eventName} is not a pull request` };
|
|
107
|
+
if (context.token === undefined) {
|
|
108
|
+
return { skipped: "set GITHUB_TOKEN in the step's env (GITHUB_TOKEN: ${{ github.token }})" };
|
|
109
|
+
}
|
|
110
|
+
return { token: context.token, pullRequest: context.pullRequest };
|
|
111
|
+
}
|
|
112
|
+
async function writeSummary(context, text, deps) {
|
|
113
|
+
if (context.stepSummaryPath === undefined)
|
|
114
|
+
return 'none';
|
|
115
|
+
try {
|
|
116
|
+
await deps.appendFile(context.stepSummaryPath, `${text}\n`);
|
|
117
|
+
return 'written';
|
|
118
|
+
}
|
|
119
|
+
catch (error) {
|
|
120
|
+
return { failed: error instanceof Error ? error.message : String(error) };
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
/** Reports one finished run and resolves with the summary rows describing what happened. */
|
|
124
|
+
export async function reportRun(run, signal, options, deps) {
|
|
125
|
+
const context = await detectActions(deps);
|
|
126
|
+
if (context === undefined)
|
|
127
|
+
return [{ label: SUMMARY_LABEL, text: 'not posted: not running on GitHub Actions' }];
|
|
128
|
+
// One page for both places; the comment carries the marker a rerun finds it by.
|
|
129
|
+
// A rerun over the failed tests is folded into the run it selected from, so
|
|
130
|
+
// the page keeps the whole suite. Evidence links land on the run page's
|
|
131
|
+
// Artifacts section, where the job's upload-artifact step put the files;
|
|
132
|
+
// the page names each file's path inside it.
|
|
133
|
+
const report = run.lastRun === undefined ? run.report : foldLastRun(run.report, run.lastRun);
|
|
134
|
+
const page = renderMarkdownReport(report, {
|
|
135
|
+
artifactsUrl: `${context.runUrl}#artifacts`,
|
|
136
|
+
sourceUrl: sourceUrl(context, run.projectRoot, deps),
|
|
137
|
+
title: options.key,
|
|
138
|
+
});
|
|
139
|
+
const summary = await writeSummary(context, page, deps);
|
|
140
|
+
const post = posting(context);
|
|
141
|
+
const marker = commentMarker(run, context, options.key);
|
|
142
|
+
const lead = 'skipped' in post
|
|
143
|
+
? `not posted: ${post.skipped}${summary === 'written' ? '; written to the job summary' : ''}`
|
|
144
|
+
: await upsertComment({
|
|
145
|
+
fetch: deps.fetch,
|
|
146
|
+
signal,
|
|
147
|
+
apiUrl: context.apiUrl,
|
|
148
|
+
repository: context.repository,
|
|
149
|
+
...post,
|
|
150
|
+
marker,
|
|
151
|
+
body: `${marker}\n${page}`,
|
|
152
|
+
});
|
|
153
|
+
return [
|
|
154
|
+
{ label: SUMMARY_LABEL, text: lead },
|
|
155
|
+
...(typeof summary === 'object' ? [{ label: SUMMARY_LABEL, text: `job summary not written: ${summary.failed}` }] : []),
|
|
156
|
+
];
|
|
157
|
+
}
|
|
158
|
+
//# sourceMappingURL=reporter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reporter.js","sourceRoot":"","sources":["../src/reporter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAqF,MAAM,KAAK,CAAC;AAC9H,OAAO,EAAE,aAAa,EAAyC,MAAM,cAAc,CAAC;AACpF,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE1C,MAAM,aAAa,GAAG,QAAQ,CAAC;AAqB/B;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,MAAM,CAAC,OAAO,GAAkB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,CAAC,CAAC,CAAC,8BAA8B,CAAC,CAAC,CAAC,EAAE,EAAE;QAC7F,CAAC,CAAC,MAAM,aAAa,CAAC;YAClB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,MAAM;YACN,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,GAAG,IAAI;YACP,MAAM;YACN,IAAI,EAAE,GAAG,MAAM,KAAK,IAAI,EAAE;SAC3B,CAAC,CAAC;IAET,OAAO;QACL,EAAE,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,IAAI,EAAE;QACpC,GAAG,CAAC,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,4BAA4B,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;KACvH,CAAC;AACJ,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@e2e-dev/github",
|
|
3
|
+
"version": "0.3.0-canary-20260928184528",
|
|
4
|
+
"description": "GitHub reporter for e2e: one pull request comment per run, from GitHub Actions",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"e2e",
|
|
7
|
+
"testing",
|
|
8
|
+
"agentic",
|
|
9
|
+
"end-to-end",
|
|
10
|
+
"reporter",
|
|
11
|
+
"github",
|
|
12
|
+
"github-actions",
|
|
13
|
+
"pull-request"
|
|
14
|
+
],
|
|
15
|
+
"license": "Apache-2.0",
|
|
16
|
+
"contributors": [
|
|
17
|
+
"Oskar Kwaśniewski <oskar@tester.army>",
|
|
18
|
+
"Szymon Rybczak <szymon@tester.army>"
|
|
19
|
+
],
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "git+https://github.com/tester-army/e2e.git",
|
|
23
|
+
"directory": "packages/github"
|
|
24
|
+
},
|
|
25
|
+
"bugs": {
|
|
26
|
+
"url": "https://github.com/tester-army/e2e/issues"
|
|
27
|
+
},
|
|
28
|
+
"homepage": "https://github.com/tester-army/e2e/tree/main/packages/github#readme",
|
|
29
|
+
"publishConfig": {
|
|
30
|
+
"registry": "https://registry.npmjs.org/",
|
|
31
|
+
"access": "public",
|
|
32
|
+
"provenance": false,
|
|
33
|
+
"tag": "beta"
|
|
34
|
+
},
|
|
35
|
+
"type": "module",
|
|
36
|
+
"exports": {
|
|
37
|
+
".": {
|
|
38
|
+
"types": "./dist/index.d.ts",
|
|
39
|
+
"default": "./dist/index.js"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"files": [
|
|
43
|
+
"dist",
|
|
44
|
+
"NOTICE"
|
|
45
|
+
],
|
|
46
|
+
"peerDependencies": {
|
|
47
|
+
"e2e": "0.15.0-canary-20260928184528"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"e2e": "0.15.0-canary-20260928184528",
|
|
51
|
+
"@types/node": "26.6.2",
|
|
52
|
+
"typescript": "7.0.2",
|
|
53
|
+
"vitest": "5.0.1"
|
|
54
|
+
},
|
|
55
|
+
"engines": {
|
|
56
|
+
"node": ">=22.12.0"
|
|
57
|
+
},
|
|
58
|
+
"scripts": {
|
|
59
|
+
"build": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\" && tsc --project tsconfig.build.json && node ../../scripts/stamp-dist.ts",
|
|
60
|
+
"typecheck": "tsc --noEmit",
|
|
61
|
+
"test": "vitest run",
|
|
62
|
+
"test:watch": "vitest",
|
|
63
|
+
"test:unit": "vitest run tests/unit"
|
|
64
|
+
}
|
|
65
|
+
}
|