#!/usr/bin/env node // Fail loudly when the browser lane is invoked without prerequisites. // The lane must never report "green" simply because nothing browser-backed // was discovered — a missing RUN_BROWSER_TESTS or PLAYWRIGHT_CHROMIUM_BIN is // a real configuration error, not a passing run. DEV_SERVER_URL intentionally // stays optional here because tests/invariants/support/env.ts defines a // runtime default of http://localhost:7002. const missing = [] if (process.env.RUN_BROWSER_TESTS !== '1') { missing.push('RUN_BROWSER_TESTS=1') } if (!process.env.PLAYWRIGHT_CHROMIUM_BIN) { missing.push('PLAYWRIGHT_CHROMIUM_BIN=') } if (missing.length > 0) { console.error( 'Invariant lane prerequisites missing:\n - ' + missing.join('\n - ') + '\n\nThe browser lane is opt-in. Set these env vars and run again:\n' + ' RUN_BROWSER_TESTS=1 \\\n' + ' DEV_SERVER_URL=http://localhost:7002 # optional; defaults to this value \\\n' + ' PLAYWRIGHT_CHROMIUM_BIN=$(command -v chromium) \\\n' + ' bun run test:invariants', ) process.exit(1) }