import assert from 'node:assert/strict'; import { spawnSync } from 'node:child_process'; import { test } from 'node:test'; import { fileURLToPath } from 'node:url'; import { dirname, resolve } from 'node:path'; const optIn = 'WIN32_DRIVE_DESKTOP_TEST'; const consent = 'I_UNDERSTAND_THIS_CONTROLS_MY_DESKTOP'; const skip = process.platform !== 'win32' ? 'requires Windows' : process.env[optIn] !== consent ? `requires explicit consent: ${optIn}=${consent}` : false; test('win32-drive PowerShell desktop integration suite', { skip }, () => { const script = resolve(dirname(fileURLToPath(import.meta.url)), 'scripts/win32-drive.test.ps1'); const result = spawnSync('powershell.exe', [ '-NoProfile', '-NonInteractive', '-ExecutionPolicy', 'Bypass', '-File', script, ], { encoding: 'utf8', windowsHide: true }); assert.ifError(result.error); assert.equal(result.status, 0, result.stderr || result.stdout); assert.match(result.stdout, /\bOK\b/); });