# extendify/3.1.0/tests/playwright/scripts/discover-playwright-projects.mjs

Extendify, version 3.1.0. 45 lines.

- Page: https://pluginprobe.com/plugins/extendify/3.1.0/code/tests/playwright/scripts/discover-playwright-projects.mjs
- Raw: https://pluginprobe.com/plugins/extendify/3.1.0/raw/tests/playwright/scripts/discover-playwright-projects.mjs
- Modified: 2026-06-11T18:37:12+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/extendify/3.1.0/code/tests/playwright/scripts/discover-playwright-projects.mjs#L10-L20`.

```javascript
#!/usr/bin/env node
import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';
import { dirname, join, relative, sep } from 'node:path';

const TEST_DIR = 'tests/playwright';

const walk = (dir) =>
	readdirSync(dir).flatMap((entry) => {
		const full = join(dir, entry);
		return statSync(full).isDirectory()
			? walk(full)
			: entry.endsWith('.spec.ts')
				? [full]
				: [];
	});

const hasBlueprint = (spec) => {
	let dir = dirname(spec);
	while (dir.startsWith(TEST_DIR) || dir === TEST_DIR) {
		if (existsSync(join(dir, 'blueprint.json'))) return true;
		if (dir === TEST_DIR) return false;
		dir = dirname(dir);
	}
	return false;
};

// A first-line `// e2e:disabled` marker keeps a spec on disk but out of the CI
// matrix — the equivalent of a commented-out entry in cypress-push.yml.
const isDisabled = (spec) =>
	readFileSync(spec, 'utf8').split('\n', 1)[0].includes('e2e:disabled');

const projects = existsSync(TEST_DIR)
	? walk(TEST_DIR)
			.filter(hasBlueprint)
			.filter((s) => !isDisabled(s))
			.map((s) =>
				relative(TEST_DIR, s)
					.replace(/\.spec\.ts$/, '')
					.split(sep)
					.join('/'),
			)
	: [];

process.stdout.write(JSON.stringify(projects));

```
