fix: harden CHRNX theme tooling
This commit is contained in:
5 files changed
+55
-256
No files matched your search
@@ -6,11 +6,40 @@ 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('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, /<rule ref="WordPress-Core"\/>/);
|
||||
assert.match(phpcs, /<rule ref="WordPress-Extra"\/>/);
|
||||
assert.match(phpcs, /name="text_domain"[^>]+value="chrnx"/);
|
||||
assert.match(phpcs, /name="prefixes"[^>]+value="chrnx_"/);
|
||||
assert.match(phpunit, /bootstrap="tests\/php\/bootstrap\.php"/);
|
||||
assert.match(phpunit, /failOnEmptyTestSuite="true"/);
|
||||
assert.match(phpunit, /<directory suffix="\.php">tests\/php<\/directory>/);
|
||||
});
|
||||
Reference in new issue
Block a user