Files
orca/tests/e2e/helpers/electron-launch-args.unit.test.ts
Neil 1848855515 test: enable software WebGL for Linux CI headful specs (#19001)
* test: enable CI WebGL and route GPU-dependent regressions

* test: retain headful atlas cases in terminal rendering goldens

* test: reuse golden command in project coverage assertions
2026-09-06 19:27:12 -07:00

48 lines
1.7 KiB
TypeScript

import { join } from 'node:path'
import { afterEach, describe, expect, it, vi } from 'vitest'
import { getOrcaElectronLaunchArgs } from './electron-launch-args'
describe('getOrcaElectronLaunchArgs', () => {
afterEach(() => vi.unstubAllGlobals())
it.each([
['linux', 'true', true, true],
['linux', undefined, true, false],
['linux', 'true', false, false],
['darwin', 'true', true, false],
['win32', 'true', true, false]
] as const)(
'scopes software WebGL to Linux CI headful launches: %s/%s/%s',
(platform, ci, headful, enabled) => {
vi.stubGlobal('process', { ...process, platform, env: { ...process.env, CI: ci } })
const args = getOrcaElectronLaunchArgs(join('orca', 'out', 'main', 'index.js'), headful)
expect(args.includes('--use-gl=angle')).toBe(enabled)
expect(args.includes('--use-angle=swiftshader')).toBe(enabled)
expect(args.includes('--enable-unsafe-swiftshader')).toBe(enabled)
if (enabled) {
expect(args).toContain('--disable-gpu-sandbox')
expect(args).not.toContain('--disable-gpu')
}
}
)
it('launches the package root that owns the compiled main entry', () => {
const root = join('workspace', 'orca')
const mainPath = join(root, 'out', 'main', 'index.js')
const args = getOrcaElectronLaunchArgs(mainPath, true)
if (process.platform === 'darwin') {
expect(args).toEqual([
'--password-store=basic',
'--use-mock-keychain',
root,
'-ApplePersistenceIgnoreState',
'YES'
])
} else {
expect(args.at(-1)).toBe(root)
}
expect(getOrcaElectronLaunchArgs(mainPath, false)).toContain(root)
})
})