fix: create traces dir in /tmp instead of cwd (#11699)

This commit is contained in:
Yury Semikhatsky 2022-01-27 14:58:17 -08:00 committed by GitHub
parent d305a2ab3f
commit 480338d5f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 5 deletions

View File

@ -31,8 +31,6 @@ import { helper } from './helper';
import { RecentLogsCollector } from '../utils/debugLogger';
import { CallMetadata, SdkObject } from './instrumentation';
const ARTIFACTS_FOLDER = path.join(os.tmpdir(), 'playwright-artifacts-');
export abstract class BrowserType extends SdkObject {
private _name: BrowserName;
readonly _playwrightOptions: PlaywrightOptions;
@ -143,7 +141,7 @@ export abstract class BrowserType extends SdkObject {
if (options.tracesDir)
await fs.promises.mkdir(options.tracesDir, { recursive: true });
const artifactsDir = await fs.promises.mkdtemp(ARTIFACTS_FOLDER);
const artifactsDir = await fs.promises.mkdtemp(path.join(os.tmpdir(), 'playwright-artifacts-'));
tempDirectories.push(artifactsDir);
if (userDataDir) {

View File

@ -16,7 +16,7 @@
import { EventEmitter } from 'events';
import fs from 'fs';
import { APIRequestContext } from '../../fetch';
import os from 'os';
import path from 'path';
import yazl from 'yazl';
import { NameValue } from '../../../common/types';
@ -27,6 +27,7 @@ import { assert, calculateSha1, createGuid, mkdirIfNeeded, monotonicTime, remove
import { Artifact } from '../../artifact';
import { BrowserContext } from '../../browserContext';
import { ElementHandle } from '../../dom';
import { APIRequestContext } from '../../fetch';
import { CallMetadata, InstrumentationListener, SdkObject } from '../../instrumentation';
import { Page } from '../../page';
import * as har from '../../supplements/har/har';
@ -192,7 +193,7 @@ export class Tracing extends SdkObject implements InstrumentationListener, Snaps
private async _createTracesDirIfNeeded() {
if (this._precreatedTracesDir)
return this._precreatedTracesDir;
this._tracesTmpDir = await fs.promises.mkdtemp('playwright-tracing-');
this._tracesTmpDir = await fs.promises.mkdtemp(path.join(os.tmpdir(), 'playwright-tracing-'));
return this._tracesTmpDir;
}