import assert from 'node:assert/strict'; import { readFile } from 'node:fs/promises'; import test from 'node:test'; test('tooling is pinned and wp-env maps this repo as chrnx', async () => { const pkg = JSON.parse(await readFile('package.json', 'utf8')); const env = JSON.parse(await readFile('.wp-env.json', 'utf8')); assert.equal(pkg.engines.node, '>=22 <27'); assert.equal(pkg.packageManager, 'npm@11.17.0'); assert.equal(pkg.devDependencies['@wordpress/env'], '11.12.0'); assert.equal(pkg.devDependencies['@wordpress/scripts'], '34.0.0'); assert.equal(pkg.devDependencies['@playwright/test'], '1.62.1'); assert.equal(pkg.devDependencies.lighthouse, '13.4.1'); assert.equal(env.core, 'https://wordpress.org/wordpress-6.9.6.zip'); assert.equal(env.phpVersion, '8.3'); assert.equal(env.autoPort, false); assert.equal(env.port, 8888); assert.equal(env.config.WP_DEBUG, true); assert.equal(env.config.SCRIPT_DEBUG, true); assert.equal(env.mappings['wp-content/themes/chrnx'], '.'); }); test('scripts activate chrnx and run Composer from the mapped theme', async () => { const pkg = JSON.parse(await readFile('package.json', 'utf8')); assert.equal(pkg.scripts['env:activate'], 'wp-env run cli wp theme activate chrnx'); assert.equal( pkg.scripts.composer, 'wp-env run cli --env-cwd=wp-content/themes/chrnx composer', ); }); test('Jest discovers JavaScript tests only from the active checkout', async () => { const pkg = JSON.parse(await readFile('package.json', 'utf8')); assert.match( pkg.scripts['test:js'], /--modulePathIgnorePatterns='\/\.worktrees\/'/, ); assert.equal(pkg.jest, undefined); }); test('PHP quality tools enforce the CHRNX conventions and cannot pass an empty suite', async () => { const phpcs = await readFile('phpcs.xml.dist', 'utf8'); const phpunit = await readFile('phpunit.xml.dist', 'utf8'); assert.match(phpcs, //); assert.match(phpcs, //); assert.match(phpcs, /name="text_domain"[^>]+value="chrnx"/); assert.match(phpcs, /name="prefixes"[^>]+value="chrnx_"/); assert.match(phpcs, /\*\/\.worktrees\/\*<\/exclude-pattern>/); assert.match(phpunit, /bootstrap="tests\/php\/bootstrap\.php"/); assert.match(phpunit, /failOnEmptyTestSuite="true"/); assert.match(phpunit, /tests\/php<\/directory>/); });