mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-05 16:34:00 +01:00
test(browse): run watchdog test servers under a private HOME
The headed-mode case starts a real server with BROWSE_HEADED=1, and its headed launch writes ~/.gstack/.auth.json for the extension. With the caller's HOME, a slow kill let that write reach the real home and failed the free runner's home-containment check (free-suite shard 5 on #3075). Give each spawned server a private HOME and GSTACK_HOME, keeping Playwright's browser cache path. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
b69616278c
commit
b5604e91be
1 file changed
+10
@@ -51,9 +51,19 @@ afterEach(async () => {
|
||||
|
||||
function spawnServer(env: Record<string, string>): Subprocess {
|
||||
const stateFile = path.join(tmpDir, 'browse-state.json');
|
||||
const home = path.join(tmpDir, 'home');
|
||||
fs.mkdirSync(home, { recursive: true });
|
||||
return spawn(['bun', 'run', SERVER_SCRIPT], {
|
||||
env: {
|
||||
...process.env,
|
||||
// The headed server writes ~/.gstack/.auth.json for its extension.
|
||||
HOME: home,
|
||||
USERPROFILE: home,
|
||||
GSTACK_HOME: path.join(home, '.gstack'),
|
||||
PLAYWRIGHT_BROWSERS_PATH: process.env.PLAYWRIGHT_BROWSERS_PATH || path.join(
|
||||
process.env.XDG_CACHE_HOME || path.join(os.homedir(), process.platform === 'darwin' ? 'Library/Caches' : '.cache'),
|
||||
'ms-playwright',
|
||||
),
|
||||
BROWSE_STATE_FILE: stateFile,
|
||||
BROWSE_PORT: '0', // Use the existing available-port allocator; fixed ports can collide across shards.
|
||||
...env,
|
||||
|
||||
Reference in new issue
Block a user