Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/src/host/git-info.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ describe('gitInfo', () => {

it('hands git the canonical path, never the symlink it was given', async () => {
const link = join(root, 'link-to-src');
symlinkSync(join(root, 'myrepo/src'), link);
// A directory junction exercises realpath without Windows symlink privileges.
symlinkSync(join(root, 'myrepo/src'), link, process.platform === 'win32' ? 'junction' : 'dir');
spawned.length = 0;
expect((await gitInfo([link]))[link]).toEqual({ repo: 'myrepo', branch: 'main' });
const dirs = spawned.map((args) => args[args.indexOf('-C') + 1]);
Expand Down
7 changes: 5 additions & 2 deletions lib/src/host/playwright-install.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @vitest-environment node
import { afterEach, beforeEach, expect, test } from 'vitest';
import { mkdirSync, mkdtempSync, realpathSync, rmSync, symlinkSync, writeFileSync } from 'node:fs';
import { mkdirSync, mkdtempSync, realpathSync, rmSync, statSync, symlinkSync, writeFileSync } from 'node:fs';
import os from 'node:os';
import path from 'node:path';
import { resolvePlaywrightInstall } from './playwright-install';
Expand All @@ -25,7 +25,10 @@ function write(file: string, text: string): string {

function link(target: string, at: string): void {
mkdirSync(path.dirname(at), { recursive: true });
symlinkSync(target, at);
// Windows package managers use directory junctions without symlink privileges.
// File links stay real symlinks for the POSIX launcher layouts.
const directory = statSync(path.resolve(path.dirname(at), target)).isDirectory();
symlinkSync(target, at, process.platform === 'win32' && directory ? 'junction' : undefined);
}

function cliPackage(dir: string, bin = 'playwright-cli.js'): void {
Expand Down
Loading