Skip to content

Commit

Permalink
fix: per-user cache folders (#22046)
Browse files Browse the repository at this point in the history
Fixes #21859
  • Loading branch information
aslushnikov committed Mar 29, 2023
1 parent 4f4a630 commit bb6b442
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/playwright-test/src/common/compilationCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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>();
Expand Down

0 comments on commit bb6b442

Please sign in to comment.