Skip to content
Open
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
16 changes: 16 additions & 0 deletions config/scripts/pnpm-cli-spawn.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
export function resolvePnpmCliSpawn(
args,
{
platform = process.platform,
nodePath = process.execPath,
npmExecPath = process.env.npm_execpath
} = {}
) {
if (platform !== 'win32') {
return { command: 'pnpm', args }
}
if (!npmExecPath) {
throw new Error('Run this command through pnpm so its Windows CLI path is available.')
}
return { command: nodePath, args: [npmExecPath, ...args] }
}
34 changes: 34 additions & 0 deletions config/scripts/pnpm-cli-spawn.test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { describe, expect, it } from 'vitest'
import { resolvePnpmCliSpawn } from './pnpm-cli-spawn.mjs'

describe('resolvePnpmCliSpawn', () => {
it('uses the executable directly on POSIX', () => {
expect(resolvePnpmCliSpawn(['run', 'typecheck'], { platform: 'linux' })).toEqual({
command: 'pnpm',
args: ['run', 'typecheck']
})
})

it('preserves whitespace arguments without a Windows command shell', () => {
expect(
resolvePnpmCliSpawn(['exec', 'playwright', '--grep', 'legacy SSH fork'], {
platform: 'win32',
nodePath: 'C:\\Program Files\\nodejs\\node.exe',
npmExecPath: 'C:\\pnpm\\pnpm.cjs'
})
).toEqual({
command: 'C:\\Program Files\\nodejs\\node.exe',
args: ['C:\\pnpm\\pnpm.cjs', 'exec', 'playwright', '--grep', 'legacy SSH fork']
})
})

it('requires pnpm package-script context on Windows', () => {
expect(() =>
resolvePnpmCliSpawn([], {
platform: 'win32',
nodePath: 'node.exe',
npmExecPath: undefined
})
).toThrow('Run this command through pnpm')
})
})
40 changes: 40 additions & 0 deletions config/scripts/run-ssh-docker-fork-upstream-backfill-e2e.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { spawnSync } from 'node:child_process'
import { resolvePnpmCliSpawn } from './pnpm-cli-spawn.mjs'

const rawExtraArgs = process.argv.slice(2)
const extraArgs = rawExtraArgs[0] === '--' ? rawExtraArgs.slice(1) : rawExtraArgs
const env = {
...process.env,
ORCA_E2E_SSH_DOCKER: '1'
}

const spawnOptions = {
stdio: 'inherit',
env
}

function runPnpm(args) {
const invocation = resolvePnpmCliSpawn(args)
return spawnSync(invocation.command, invocation.args, spawnOptions)
}

const runtime = runPnpm(['run', 'ensure:electron-runtime'])

if (runtime.status !== 0) {
process.exit(runtime.status ?? 1)
}

const result = runPnpm([
'exec',
'playwright',
'test',
'tests/e2e/ssh-docker-fork-upstream-backfill.spec.ts',
'--config',
'tests/playwright.config.ts',
'--project',
'electron-headless',
'--workers=1',
...extraArgs
])

process.exit(result.status ?? 1)
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
"test:e2e:terminal-perf:html-report": "node config/scripts/generate-terminal-perf-html-report.mjs",
"test:e2e:ssh-docker-perf": "node config/scripts/run-ssh-docker-perf-e2e.mjs",
"test:e2e:ssh-docker-watcher-isolation": "node config/scripts/run-ssh-docker-watcher-isolation-e2e.mjs",
"test:e2e:ssh-docker-fork-upstream-backfill": "node config/scripts/run-ssh-docker-fork-upstream-backfill-e2e.mjs",
"test:e2e:ssh-docker-terminal-parking": "node config/scripts/run-ssh-docker-terminal-parking-e2e.mjs",
"test:e2e:nested-runtime-ssh": "node config/scripts/run-nested-runtime-ssh-e2e.mjs",
"test:e2e:source-control-scale": "pnpm run ensure:electron-runtime && npx playwright test tests/e2e/source-control-large-file-count.spec.ts --config tests/playwright.config.ts --project electron-headless --workers=1",
Expand Down
Loading
Loading