Skip to content

Turn any idea, plan, or codebase into a beautiful interactive diagram. An agent skill for Claude Code, Codex, and more.

fix(browser): discover Edge on macOS and Linux after Chrome and Chromium

Saim Shafiqued8de43f966d0
diff --git a/archify/bin/visual-check.mjs b/archify/bin/visual-check.mjs
index 1a9727bc..8b40aa97 100644
--- a/archify/bin/visual-check.mjs
+++ b/archify/bin/visual-check.mjs
@@ -1359,6 +1359,18 @@ export function findChrome({
}
return findOnPath('msedge', env, platform, resolveExecutable);
}
+ // macOS and Linux: probe Edge behind every Chrome/Chromium candidate, the
+ // same way Windows does. #920 asked for `microsoft-edge`,
+ // `microsoft-edge-stable`, and the macOS application bundle.
+ if (platform === 'darwin') {
+ const edgeApp = '/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge';
+ const resolved = resolveExecutable(edgeApp, platform);
+ if (resolved) return resolved;
+ }
+ for (const command of ['microsoft-edge', 'microsoft-edge-stable']) {
+ const resolved = findOnPath(command, env, platform, resolveExecutable);
+ if (resolved) return resolved;
+ }
return null;
}
@@ -2504,14 +2516,14 @@ async function runBrowserEvidence({
receipt.viewerChrome.status = 'skipped';
receipt.themeStates.status = 'skipped';
if (capture) receipt.captures.status = 'skipped';
- receipt.error = 'No supported browser found. Install Chrome/Chromium (or Microsoft Edge on Windows), or set ARCHIFY_CHROME to its executable path.';
+ receipt.error = 'No supported browser found. Install Chrome/Chromium (or Microsoft Edge), or set ARCHIFY_CHROME to its executable path.';
receipt.diagnostics = [failureDiagnostic({
code: 'viewer/chrome-unavailable',
severity: 'warning',
message: receipt.error,
subject: { artifact },
evidence: { executable: null },
- supportedFixes: [`set ARCHIFY_CHROME to a Chrome/Chromium executable (or Microsoft Edge on Windows) and rerun ${command}`],
+ supportedFixes: [`set ARCHIFY_CHROME to a Chrome/Chromium executable (or Microsoft Edge) and rerun ${command}`],
})];
const publication = publishReceiptOnly(artifact, outputs, receipt, ownership);
if (publication.ok) publishedBrowserEvidenceReceipts.add(receipt);
diff --git a/archify/references/delivery-contract.md b/archify/references/delivery-contract.md
index f9ec6b33..8292dd1d 100644
--- a/archify/references/delivery-contract.md
+++ b/archify/references/delivery-contract.md
@@ -423,12 +423,14 @@ command is:
node bin/archify.mjs browser-check <output.html> --json --require-provenance
```
-The zero-dependency command uses Chrome/Chromium (or Microsoft Edge on Windows)
+The zero-dependency command uses Chrome/Chromium (or Microsoft Edge)
through the DevTools pipe. `ARCHIFY_CHROME` is authoritative when set, including
an invalid path: Archify does not silently fall back to another browser. Automatic
Windows discovery checks every Chrome/Chromium install location and PATH command
first, then Edge under `%ProgramFiles(x86)%`, `%ProgramFiles%`, and `%LocalAppData%`,
-followed by `msedge` on PATH. Non-Windows automatic discovery is unchanged. It
+followed by `msedge` on PATH. On macOS and Linux, discovery also checks
+Chrome/Chromium first, then the Edge application bundle (macOS) and
+`microsoft-edge`/`microsoft-edge-stable` on PATH. It
measures light-theme containment at 1440×900, 1600×1000, 1920×1080, and
2048×1320, and verifies the requested light theme at all four viewports, the dark
theme at both endpoints, and READ/Still runtime states. A requested theme that
diff --git a/scripts/run-browser-tests.mjs b/scripts/run-browser-tests.mjs
index 3b1f06b7..bfbb17a9 100644
--- a/scripts/run-browser-tests.mjs
+++ b/scripts/run-browser-tests.mjs
@@ -29,7 +29,7 @@ if (options.list) {
const chrome = findChrome();
if (!chrome) {
- console.error('Browser tests require an executable Chrome/Chromium (or Microsoft Edge on Windows). Set ARCHIFY_CHROME to its path; this gate cannot skip browser coverage.');
+ console.error('Browser tests require an executable Chrome/Chromium (or Microsoft Edge). Set ARCHIFY_CHROME to its path; this gate cannot skip browser coverage.');
process.exit(1);
}
diff --git a/test/visual-check.test.mjs b/test/visual-check.test.mjs
index 6bd7f6d4..ca5ac212 100644
--- a/test/visual-check.test.mjs
+++ b/test/visual-check.test.mjs
@@ -325,14 +325,51 @@ test('findChrome checks installed Edge before its Windows PATH fallback', () =>
}
});
-test('findChrome leaves non-Windows discovery unchanged and returns null when nothing is found', () => {
+test('findChrome discovers Edge from the macOS application bundle', () => {
+ const expected = '/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge';
+ assert.equal(findChrome({
+ platform: 'darwin', env: { PATH: '/usr/bin' },
+ resolveExecutable: (candidate) => candidate === expected ? candidate : null,
+ }), expected);
+});
+
+test('findChrome finds microsoft-edge command names on a macOS or Linux PATH', () => {
+ for (const platform of ['darwin', 'linux']) {
+ for (const command of ['microsoft-edge', 'microsoft-edge-stable']) {
+ const expected = `/usr/bin/${command}`;
+ assert.equal(findChrome({
+ platform, env: { PATH: '/usr/bin' },
+ resolveExecutable: (candidate) => candidate === expected ? candidate : null,
+ }), expected, `${platform}:${command}`);
+ }
+ }
+});
+
+test('findChrome keeps Chrome/Chromium ahead of Edge on macOS and Linux', () => {
+ for (const platform of ['darwin', 'linux']) {
+ const chrome = platform === 'darwin'
+ ? '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'
+ : '/usr/bin/google-chrome';
+ const edge = platform === 'darwin'
+ ? '/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge'
+ : '/usr/bin/microsoft-edge';
+ assert.equal(findChrome({
+ platform, env: { PATH: '/usr/bin' },
+ resolveExecutable: (candidate) => [chrome, edge].includes(candidate) ? candidate : null,
+ }), chrome, platform);
+ }
+});
+
+test('findChrome returns null when no browser is found and probes Edge on non-Windows', () => {
for (const platform of ['win32', 'darwin', 'linux']) {
const checked = [];
assert.equal(findChrome({
platform, env: { PATH: '/usr/bin', PROGRAMFILES: String.raw`C:\Program Files` },
resolveExecutable(candidate) { checked.push(candidate); return null; },
- }), null);
- if (platform !== 'win32') assert.equal(checked.some((candidate) => /edge/i.test(candidate)), false);
+ }), null, platform);
+ if (platform !== 'win32') {
+ assert.ok(checked.some((candidate) => /edge/i.test(candidate)), `${platform} probes Edge candidates`);
+ }
}
});