Skip to content

Commit bb6b442

Browse files
authored
fix: per-user cache folders (microsoft#22046)
Fixes microsoft#21859
1 parent 4f4a630 commit bb6b442

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/playwright-test/src/common/compilationCache.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import fs from 'fs';
1919
import os from 'os';
2020
import path from 'path';
2121
import { sourceMapSupport } from '../utilsBundle';
22+
import { sanitizeForFilePath } from '../util';
2223

2324
export type MemoryCache = {
2425
codePath: string;
@@ -27,7 +28,11 @@ export type MemoryCache = {
2728
};
2829

2930
const version = 13;
30-
const cacheDir = process.env.PWTEST_CACHE_DIR || path.join(os.tmpdir(), 'playwright-transform-cache');
31+
32+
const DEFAULT_CACHE_DIR_WIN32 = path.join(os.tmpdir(), `playwright-transform-cache`);
33+
const DEFAULT_CACHE_DIR_POSIX = path.join(os.tmpdir(), `playwright-transform-cache-` + sanitizeForFilePath(os.userInfo().username));
34+
35+
const cacheDir = process.env.PWTEST_CACHE_DIR || (process.platform === 'win32' ? DEFAULT_CACHE_DIR_WIN32 : DEFAULT_CACHE_DIR_POSIX);
3136

3237
const sourceMaps: Map<string, string> = new Map();
3338
const memoryCache = new Map<string, MemoryCache>();

0 commit comments

Comments
 (0)