mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-14 21:53:35 +03:00
fix: create traces dir in /tmp instead of cwd (#11699)
This commit is contained in:
parent
d305a2ab3f
commit
480338d5f3
@ -31,8 +31,6 @@ import { helper } from './helper';
|
|||||||
import { RecentLogsCollector } from '../utils/debugLogger';
|
import { RecentLogsCollector } from '../utils/debugLogger';
|
||||||
import { CallMetadata, SdkObject } from './instrumentation';
|
import { CallMetadata, SdkObject } from './instrumentation';
|
||||||
|
|
||||||
const ARTIFACTS_FOLDER = path.join(os.tmpdir(), 'playwright-artifacts-');
|
|
||||||
|
|
||||||
export abstract class BrowserType extends SdkObject {
|
export abstract class BrowserType extends SdkObject {
|
||||||
private _name: BrowserName;
|
private _name: BrowserName;
|
||||||
readonly _playwrightOptions: PlaywrightOptions;
|
readonly _playwrightOptions: PlaywrightOptions;
|
||||||
@ -143,7 +141,7 @@ export abstract class BrowserType extends SdkObject {
|
|||||||
if (options.tracesDir)
|
if (options.tracesDir)
|
||||||
await fs.promises.mkdir(options.tracesDir, { recursive: true });
|
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);
|
tempDirectories.push(artifactsDir);
|
||||||
|
|
||||||
if (userDataDir) {
|
if (userDataDir) {
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
import { EventEmitter } from 'events';
|
import { EventEmitter } from 'events';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import { APIRequestContext } from '../../fetch';
|
import os from 'os';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import yazl from 'yazl';
|
import yazl from 'yazl';
|
||||||
import { NameValue } from '../../../common/types';
|
import { NameValue } from '../../../common/types';
|
||||||
@ -27,6 +27,7 @@ import { assert, calculateSha1, createGuid, mkdirIfNeeded, monotonicTime, remove
|
|||||||
import { Artifact } from '../../artifact';
|
import { Artifact } from '../../artifact';
|
||||||
import { BrowserContext } from '../../browserContext';
|
import { BrowserContext } from '../../browserContext';
|
||||||
import { ElementHandle } from '../../dom';
|
import { ElementHandle } from '../../dom';
|
||||||
|
import { APIRequestContext } from '../../fetch';
|
||||||
import { CallMetadata, InstrumentationListener, SdkObject } from '../../instrumentation';
|
import { CallMetadata, InstrumentationListener, SdkObject } from '../../instrumentation';
|
||||||
import { Page } from '../../page';
|
import { Page } from '../../page';
|
||||||
import * as har from '../../supplements/har/har';
|
import * as har from '../../supplements/har/har';
|
||||||
@ -192,7 +193,7 @@ export class Tracing extends SdkObject implements InstrumentationListener, Snaps
|
|||||||
private async _createTracesDirIfNeeded() {
|
private async _createTracesDirIfNeeded() {
|
||||||
if (this._precreatedTracesDir)
|
if (this._precreatedTracesDir)
|
||||||
return 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;
|
return this._tracesTmpDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user