Skip to content

Commit 01d9387

Browse files
topcoder1claude
andauthored
fix(tests): skip Playwright tests when browser not installed (#77)
## Task nanoclaw Coverage Floor fix — guard Playwright-dependent tests with skipIf ## Owned files - `src/__tests__/signer-integration.test.ts` - `src/signer/__tests__/docusign-executor.test.ts` ## Problem Both files call `chromium.launch()` in `beforeAll` hooks. When Playwright browsers aren't installed in the CI runner, the launch crashes, the 4 affected tests fail, and `coverage-summary.json` is never written → Coverage Floor CI check has been red for 8+ days. ## Fix Added `const hasPlaywright = fs.existsSync(chromium.executablePath())` and wrapped both top-level `describe` blocks with `describe.skipIf(!hasPlaywright)`. Tests still run locally and in any runner where `npx playwright install` was run. ## Acceptance command + output ``` npx vitest run --reporter=verbose 2>&1 | tail -10 # (shows skipped instead of crashed when no browser installed) ``` ## Coverage delta Before: N/A (coverage-summary.json was never written — check was always failing) After: Coverage Floor CI check unblocked; tests skip gracefully ## Auto-merge rationale Test-only change; no production code touched. Fixes a CI infrastructure failure. ## Codex pre-review skipped — sub-50-LOC trivial change ## HUMAN_READABLE_SUMMARY Two Playwright-dependent test suites were crashing the CI coverage run by calling chromium.launch() in environments where browsers aren't installed. This PR adds a one-line existsSync guard and wraps both describe blocks with describe.skipIf so they skip gracefully instead of crashing. Coverage Floor CI will be unblocked once merged. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> Co-authored-by: Claude <noreply@anthropic.com>
1 parent 2cd4571 commit 01d9387

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

src/__tests__/signer-integration.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { docusignExecutor } from '../signer/docusign-executor.js';
1616
import { getCeremony } from '../signer/ceremony-repo.js';
1717

1818
const FIXTURES = path.join(import.meta.dirname, '../signer/__tests__/fixtures');
19+
const hasPlaywright = fs.existsSync(chromium.executablePath());
1920

2021
// Test executor extends docusignExecutor with localhost/127.0.0.1 in the whitelist
2122
const testDocusignExecutor = {
@@ -27,7 +28,7 @@ const testDocusignExecutor = {
2728
],
2829
};
2930

30-
describe('signer end-to-end integration', () => {
31+
describe.skipIf(!hasPlaywright)('signer end-to-end integration', () => {
3132
let browser: Browser;
3233
let server: http.Server;
3334
let port: number;

src/signer/__tests__/docusign-executor.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { isWhitelistedUrl } from '../executor-registry.js';
1717
import type { SignCeremony, SignerProfile } from '../types.js';
1818

1919
const FIXTURES = path.join(import.meta.dirname, 'fixtures');
20+
const hasPlaywright = fs.existsSync(chromium.executablePath());
2021

2122
function makeCeremony(overrides: Partial<SignCeremony> = {}): SignCeremony {
2223
return {
@@ -49,7 +50,7 @@ const profile: SignerProfile = {
4950
updatedAt: Date.now(),
5051
};
5152

52-
describe('docusignExecutor', () => {
53+
describe.skipIf(!hasPlaywright)('docusignExecutor', () => {
5354
let browser: Browser;
5455
let server: http.Server;
5556
let port: number;

0 commit comments

Comments
 (0)