@e2e-dev/html-reporter 0.0.2 → 0.0.3-nightly-20261120030209
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/dist/.build.json +1 -1
- package/dist/reporter.d.ts +5 -8
- package/dist/reporter.js +13 -22
- package/package.json +3 -3
package/dist/.build.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"0.0.
|
|
1
|
+
{"version":"0.0.3-nightly-20261120030209"}
|
package/dist/reporter.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FinishedRun, Reporter,
|
|
1
|
+
import type { FinishedRun, Reporter, ReportFile } from 'e2e';
|
|
2
2
|
export interface HtmlReporterOptions {
|
|
3
3
|
/**
|
|
4
4
|
* Where the page goes, from the project root. Defaults to `report.html` in
|
|
@@ -31,11 +31,8 @@ export interface HtmlReporterOptions {
|
|
|
31
31
|
*/
|
|
32
32
|
export declare function htmlReporter(options?: HtmlReporterOptions): Reporter;
|
|
33
33
|
/**
|
|
34
|
-
* Fills the page template with one finished run
|
|
35
|
-
* the row naming where it went. Once `signal` aborts (the runner gave up
|
|
36
|
-
*
|
|
37
|
-
* no report (it stopped before its tests, or the write failed) writes no
|
|
38
|
-
* page either, so the previous run's page stays beside the previous run's
|
|
39
|
-
* report, as `junit.xml` and `summary.md` do.
|
|
34
|
+
* Fills the page template with one finished run: the file the runner writes,
|
|
35
|
+
* with the row naming where it went. Once `signal` aborts (the runner gave up
|
|
36
|
+
* on it), it stops reading files.
|
|
40
37
|
*/
|
|
41
|
-
export declare function
|
|
38
|
+
export declare function renderReport(run: FinishedRun, options: HtmlReporterOptions, template: string, signal?: AbortSignal): Promise<ReportFile>;
|
package/dist/reporter.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { fileURLToPath } from 'node:url';
|
|
4
4
|
import { embedPayload } from './payload.js';
|
|
@@ -20,39 +20,30 @@ const TEMPLATE_PATH = path.join(path.dirname(fileURLToPath(import.meta.url)), 'a
|
|
|
20
20
|
export function htmlReporter(options = {}) {
|
|
21
21
|
return {
|
|
22
22
|
name: 'html',
|
|
23
|
-
|
|
23
|
+
// A run that wrote no report writes no page, so the previous page stays
|
|
24
|
+
// beside the previous report, as `junit.xml` and `summary.md` do.
|
|
25
|
+
reportFiles: async (run, signal) => run.reportPath === undefined ? [] : [await renderReport(run, options, await readFile(TEMPLATE_PATH, 'utf8'), signal)],
|
|
24
26
|
};
|
|
25
27
|
}
|
|
26
28
|
/**
|
|
27
|
-
* Fills the page template with one finished run
|
|
28
|
-
* the row naming where it went. Once `signal` aborts (the runner gave up
|
|
29
|
-
*
|
|
30
|
-
* no report (it stopped before its tests, or the write failed) writes no
|
|
31
|
-
* page either, so the previous run's page stays beside the previous run's
|
|
32
|
-
* report, as `junit.xml` and `summary.md` do.
|
|
29
|
+
* Fills the page template with one finished run: the file the runner writes,
|
|
30
|
+
* with the row naming where it went. Once `signal` aborts (the runner gave up
|
|
31
|
+
* on it), it stops reading files.
|
|
33
32
|
*/
|
|
34
|
-
export async function
|
|
35
|
-
|
|
36
|
-
return undefined;
|
|
37
|
-
const outputFile = options.outputFile === undefined
|
|
38
|
-
? path.join(path.dirname(run.artifactsRoot), 'report.html')
|
|
39
|
-
: path.resolve(run.projectRoot, options.outputFile);
|
|
33
|
+
export async function renderReport(run, options, template, signal) {
|
|
34
|
+
const outputFile = path.resolve(run.projectRoot, options.outputFile ?? path.join(run.outputDir, 'report.html'));
|
|
40
35
|
const mode = options.media ?? 'link';
|
|
41
36
|
const media = await pageMedia(mode, run, outputFile, signal);
|
|
42
37
|
const resultsDir = toPosix(path.relative(run.projectRoot, run.artifactsRoot)) || '.';
|
|
43
38
|
const traces = Object.fromEntries([...run.traces].map(([id, trace]) => [id, toPosix(trace)]));
|
|
44
39
|
const sources = await sourceFrames(run.report, run.projectRoot, run.redact);
|
|
45
40
|
const page = embedPayload(template, { report: run.report, media, resultsDir, traces, sources });
|
|
46
|
-
|
|
47
|
-
await mkdir(path.dirname(outputFile), { recursive: true });
|
|
48
|
-
await writeFile(outputFile, page, 'utf8');
|
|
49
|
-
const shown = path.relative(process.cwd(), outputFile) || outputFile;
|
|
50
|
-
let note = '';
|
|
41
|
+
let note;
|
|
51
42
|
if (mode === 'embed')
|
|
52
|
-
note = `
|
|
43
|
+
note = `(one file, ${formatSize(Buffer.byteLength(page))})`;
|
|
53
44
|
if (mode === 'none')
|
|
54
|
-
note = '
|
|
55
|
-
return
|
|
45
|
+
note = '(text only)';
|
|
46
|
+
return { path: outputFile, content: page, label: 'HTML report', ...(note === undefined ? {} : { note }) };
|
|
56
47
|
}
|
|
57
48
|
/** What the page holds for screenshots and videos in each `media` mode. */
|
|
58
49
|
async function pageMedia(mode, run, outputFile, signal) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@e2e-dev/html-reporter",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3-nightly-20261120030209",
|
|
4
4
|
"description": "HTML reporter for e2e: one self-contained page per run, steps, screenshots, and video",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"e2e",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"app/Lucide-LICENSE.txt"
|
|
43
43
|
],
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"e2e": "
|
|
45
|
+
"e2e": "0.24.1-nightly-20261120030209"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@tailwindcss/vite": "4.3.5",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@types/react": "19.3.0",
|
|
51
51
|
"@types/react-dom": "19.3.0",
|
|
52
52
|
"@vitejs/plugin-react": "6.3.0",
|
|
53
|
-
"e2e": "0.24.
|
|
53
|
+
"e2e": "0.24.1-nightly-20261120030209",
|
|
54
54
|
"lucide-react": "1.76.0",
|
|
55
55
|
"react": "19.3.1",
|
|
56
56
|
"react-dom": "19.3.1",
|