mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
fix(trace viewer): updating default traceStorageDir value (#4962)
fix(trace viewer): updating default traceStorageDir value When `npx playwright show-trace <tracePath>` command is executed, without providing the `resources` optional parameter, the function expected the `traceStorageDir` default value to be the same directory as in which the tracePath resides. This change updates it to the `dirname(tracePath)/trace-resources` if it exists. Such a directory hirerachy is the default that is created when running the tracer in Playwright.
This commit is contained in:
parent
56f012043b
commit
bf64fedd88
@ -137,15 +137,13 @@ export async function showTraceViewer(traceStorageDir: string | undefined, trace
|
||||
if (!fs.existsSync(tracePath))
|
||||
throw new Error(`${tracePath} does not exist`);
|
||||
|
||||
let files: string[];
|
||||
if (fs.statSync(tracePath).isFile()) {
|
||||
files = [tracePath];
|
||||
if (!traceStorageDir)
|
||||
traceStorageDir = path.dirname(tracePath);
|
||||
} else {
|
||||
files = collectFiles(tracePath);
|
||||
if (!traceStorageDir)
|
||||
traceStorageDir = tracePath;
|
||||
const files: string[] = fs.statSync(tracePath).isFile() ? [tracePath] : collectFiles(tracePath);
|
||||
|
||||
if (!traceStorageDir) {
|
||||
traceStorageDir = fs.statSync(tracePath).isFile() ? path.dirname(tracePath) : tracePath;
|
||||
|
||||
if (fs.existsSync(traceStorageDir + '/trace-resources'))
|
||||
traceStorageDir = traceStorageDir + '/trace-resources';
|
||||
}
|
||||
|
||||
const traceViewer = new TraceViewer(traceStorageDir);
|
||||
|
Loading…
x
Reference in New Issue
Block a user