mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
chore: make generated report writable (#18750)
Fixes: https://github.com/microsoft/playwright/issues/18747
This commit is contained in:
parent
1b13519984
commit
8e882fdd58
@ -46,3 +46,8 @@ export function canAccessFile(file: string) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export async function copyFileAndMakeWritable(from: string, to: string) {
|
||||
await fs.promises.copyFile(from, to);
|
||||
await fs.promises.chmod(to, 0o664);
|
||||
}
|
||||
|
||||
@ -23,7 +23,7 @@ import { Transform } from 'stream';
|
||||
import type { FullConfig, Suite } from '../../types/testReporter';
|
||||
import { HttpServer } from 'playwright-core/lib/utils/httpServer';
|
||||
import { assert, calculateSha1 } from 'playwright-core/lib/utils';
|
||||
import { removeFolders } from 'playwright-core/lib/utils/fileUtils';
|
||||
import { copyFileAndMakeWritable, removeFolders } from 'playwright-core/lib/utils/fileUtils';
|
||||
import type { JsonAttachment, JsonReport, JsonSuite, JsonTestCase, JsonTestResult, JsonTestStep } from './raw';
|
||||
import RawReporter from './raw';
|
||||
import { stripAnsiEscapes } from './base';
|
||||
@ -272,7 +272,7 @@ class HtmlBuilder {
|
||||
|
||||
// Copy app.
|
||||
const appFolder = path.join(require.resolve('playwright-core'), '..', 'lib', 'webpack', 'htmlReport');
|
||||
fs.copyFileSync(path.join(appFolder, 'index.html'), path.join(this._reportFolder, 'index.html'));
|
||||
await copyFileAndMakeWritable(path.join(appFolder, 'index.html'), path.join(this._reportFolder, 'index.html'));
|
||||
|
||||
// Copy trace viewer.
|
||||
if (this._hasTraces) {
|
||||
@ -282,7 +282,7 @@ class HtmlBuilder {
|
||||
for (const file of fs.readdirSync(traceViewerFolder)) {
|
||||
if (file.endsWith('.map'))
|
||||
continue;
|
||||
fs.copyFileSync(path.join(traceViewerFolder, file), path.join(traceViewerTargetFolder, file));
|
||||
await copyFileAndMakeWritable(path.join(traceViewerFolder, file), path.join(traceViewerTargetFolder, file));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user