fix: per-user cache folders (#22046)
Fixes https://github.com/microsoft/playwright/issues/21859
This commit is contained in:
parent
4f4a63096e
commit
bb6b4425f7
|
|
@ -19,6 +19,7 @@ import fs from 'fs';
|
|||
import os from 'os';
|
||||
import path from 'path';
|
||||
import { sourceMapSupport } from '../utilsBundle';
|
||||
import { sanitizeForFilePath } from '../util';
|
||||
|
||||
export type MemoryCache = {
|
||||
codePath: string;
|
||||
|
|
@ -27,7 +28,11 @@ export type MemoryCache = {
|
|||
};
|
||||
|
||||
const version = 13;
|
||||
const cacheDir = process.env.PWTEST_CACHE_DIR || path.join(os.tmpdir(), 'playwright-transform-cache');
|
||||
|
||||
const DEFAULT_CACHE_DIR_WIN32 = path.join(os.tmpdir(), `playwright-transform-cache`);
|
||||
const DEFAULT_CACHE_DIR_POSIX = path.join(os.tmpdir(), `playwright-transform-cache-` + sanitizeForFilePath(os.userInfo().username));
|
||||
|
||||
const cacheDir = process.env.PWTEST_CACHE_DIR || (process.platform === 'win32' ? DEFAULT_CACHE_DIR_WIN32 : DEFAULT_CACHE_DIR_POSIX);
|
||||
|
||||
const sourceMaps: Map<string, string> = new Map();
|
||||
const memoryCache = new Map<string, MemoryCache>();
|
||||
|
|
|
|||
Loading…
Reference in a new issue