|
|
@@ -1,3 +1,5 @@
|
|
|
+/** Desktop owns the Electron devDependency; the PTC helper supplies its real runtime providers. */
|
|
|
+
|
|
|
import { mkdtemp, mkdir, readFile, rm, writeFile } from 'node:fs/promises'
|
|
|
import { existsSync } from 'node:fs'
|
|
|
import { createRequire } from 'node:module'
|
|
|
@@ -10,8 +12,11 @@ import { mountRuntime } from '../../../packages/ptc-runtime/ptc-runtime-node/tes
|
|
|
const require = createRequire(import.meta.url)
|
|
|
const electronInstalled = existsSync(join(dirname(require.resolve('electron')), 'path.txt'))
|
|
|
|
|
|
+// Both fixture-owned and shared-provider teardown await native process cleanup.
|
|
|
+vi.setConfig({ hookTimeout: 30_000 })
|
|
|
+
|
|
|
// Desktop's downloaded Electron binary is not installed by ordinary workspace dependency setup.
|
|
|
-it.skipIf(process.platform !== 'darwin' || !electronInstalled).each(['workspace-write', 'danger-full-access'] as const)('runs PTC writes under Electron with %s', async (mode) => {
|
|
|
+it.skipIf(process.platform !== 'darwin' || !electronInstalled).each(['workspace-write', 'danger-full-access'] as const)('runs PTC writes under Electron with %s', { timeout: 120_000 }, async (mode) => {
|
|
|
const electron = require('electron') as string
|
|
|
const root = await mkdtemp(join(homedir(), '.dsh-electron-ptc-'))
|
|
|
const ctx = new Context()
|
|
|
@@ -27,6 +32,8 @@ it.skipIf(process.platform !== 'darwin' || !electronInstalled).each(['workspace-
|
|
|
vi.stubEnv('DSH_TEST_RUNTIME_SECRET', 'must-not-inherit')
|
|
|
const runtime = await mountRuntime(ctx, { nodeExecutable: electron }, { mode, workspaceRoot: cwd })
|
|
|
const result = await runtime.run(runtime.resolve({
|
|
|
+ // Bound startup failure before the outer test deadline, leaving time for managed cleanup.
|
|
|
+ timeoutMs: 30_000,
|
|
|
program: `await tools.write({});
|
|
|
const fs = await import('node:fs/promises');
|
|
|
await fs.writeFile('direct.txt', 'direct');
|