import assert from 'node:assert/strict'; import { spawnSync } from 'node:child_process'; import { mkdtempSync, rmSync } from 'node:fs'; import { tmpdir } from 'node:os'; import { join } from 'node:path'; import process from 'node:process'; import test from 'node:test'; import { fileURLToPath } from 'node:url'; test( 'WebKit owns interactive navigation and preserves native back/forward history', { skip: process.platform !== 'darwin' }, () => { const directory = mkdtempSync(join(tmpdir(), 'kanbangit-navigation-')); const binary = join(directory, 'navigation-test'); try { const compile = spawnSync( 'xcrun', [ '--sdk', 'macosx', 'clang', '-fobjc-arc', '-fblocks', '-Wall', '-Werror', '-framework', 'AppKit', '-framework', 'WebKit', fileURLToPath( new URL('./navigation-macos.m', import.meta.url), ), '-o', binary, ], { encoding: 'utf8', timeout: 30000 }, ); assert.equal( compile.status, 0, compile.stderr || compile.error?.message, ); const result = spawnSync(binary, [], { encoding: 'utf8', timeout: 30000, }); assert.equal( result.status, 0, result.stderr || result.error?.message, ); assert.match(result.stdout, /PASS: WebKit/); } finally { rmSync(directory, { recursive: true, force: true }); } }, );