refactor
This commit is contained in:
parent
d703a9df60
commit
44364f3b64
|
|
@ -357,20 +357,22 @@ class HtmlBuilder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Inline report data.
|
await this._writeReportData(path.join(this._reportFolder, 'index.html'));
|
||||||
const indexFile = path.join(this._reportFolder, 'index.html');
|
|
||||||
fs.appendFileSync(indexFile, '<script>\nwindow.playwrightReportBase64 = "data:application/zip;base64,');
|
|
||||||
|
return { ok, singleTestId };
|
||||||
|
}
|
||||||
|
|
||||||
|
private async _writeReportData(path: string) {
|
||||||
|
fs.appendFileSync(path, '<script>\nwindow.playwrightReportBase64 = "data:application/zip;base64,');
|
||||||
await new Promise(f => {
|
await new Promise(f => {
|
||||||
this._dataZipFile!.end(undefined, () => {
|
this._dataZipFile!.end(undefined, () => {
|
||||||
this._dataZipFile!.outputStream
|
this._dataZipFile!.outputStream
|
||||||
.pipe(new Base64Encoder())
|
.pipe(new Base64Encoder())
|
||||||
.pipe(fs.createWriteStream(indexFile, { flags: 'a' })).on('close', f);
|
.pipe(fs.createWriteStream(path, { flags: 'a' })).on('close', f);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
fs.appendFileSync(indexFile, '";</script>');
|
fs.appendFileSync(path, '";</script>');
|
||||||
|
|
||||||
|
|
||||||
return { ok, singleTestId };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private _addDataFile(fileName: string, data: any) {
|
private _addDataFile(fileName: string, data: any) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue