test: isolate main checkout verification

This commit is contained in:
chrnx committed 2026-08-12 23:33:14 -05:00
1 parent 8fb87bf221
commit dc2b771a77
3 files changed
+13 -1

No files matched your search

+1 -1
View File
@@ -15,7 +15,7 @@
"composer": "wp-env run cli --env-cwd=wp-content/themes/chrnx composer", "composer": "wp-env run cli --env-cwd=wp-content/themes/chrnx composer",
"phpcs": "npm run composer -- exec phpcs -- -q", "phpcs": "npm run composer -- exec phpcs -- -q",
"test:smoke": "node --test tests/smoke/*.test.mjs", "test:smoke": "node --test tests/smoke/*.test.mjs",
"test:js": "wp-scripts test-unit-js --runInBand", "test:js": "wp-scripts test-unit-js --runInBand --modulePathIgnorePatterns='<rootDir>/.worktrees/'",
"test:php": "wp-env run tests-cli --env-cwd=wp-content/themes/chrnx -- composer exec phpunit --", "test:php": "wp-env run tests-cli --env-cwd=wp-content/themes/chrnx -- composer exec phpunit --",
"test:e2e": "playwright test", "test:e2e": "playwright test",
"lint:js": "wp-scripts lint-js assets/js tests/js tests/e2e", "lint:js": "wp-scripts lint-js assets/js tests/js tests/e2e",
+1
View File
@@ -4,6 +4,7 @@
<file>.</file> <file>.</file>
<arg name="extensions" value="php"/> <arg name="extensions" value="php"/>
<exclude-pattern>*/.worktrees/*</exclude-pattern>
<exclude-pattern>*/node_modules/*</exclude-pattern> <exclude-pattern>*/node_modules/*</exclude-pattern>
<exclude-pattern>*/vendor/*</exclude-pattern> <exclude-pattern>*/vendor/*</exclude-pattern>
+11
View File
@@ -31,6 +31,16 @@ test('scripts activate chrnx and run Composer from the mapped theme', async () =
); );
}); });
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='<rootDir>\/\.worktrees\/'/,
);
assert.equal(pkg.jest, undefined);
});
test('PHP quality tools enforce the CHRNX conventions and cannot pass an empty suite', async () => { test('PHP quality tools enforce the CHRNX conventions and cannot pass an empty suite', async () => {
const phpcs = await readFile('phpcs.xml.dist', 'utf8'); const phpcs = await readFile('phpcs.xml.dist', 'utf8');
const phpunit = await readFile('phpunit.xml.dist', 'utf8'); const phpunit = await readFile('phpunit.xml.dist', 'utf8');
@@ -39,6 +49,7 @@ test('PHP quality tools enforce the CHRNX conventions and cannot pass an empty s
assert.match(phpcs, /<rule ref="WordPress-Extra"\/>/); assert.match(phpcs, /<rule ref="WordPress-Extra"\/>/);
assert.match(phpcs, /name="text_domain"[^>]+value="chrnx"/); assert.match(phpcs, /name="text_domain"[^>]+value="chrnx"/);
assert.match(phpcs, /name="prefixes"[^>]+value="chrnx_"/); assert.match(phpcs, /name="prefixes"[^>]+value="chrnx_"/);
assert.match(phpcs, /<exclude-pattern>\*\/\.worktrees\/\*<\/exclude-pattern>/);
assert.match(phpunit, /bootstrap="tests\/php\/bootstrap\.php"/); assert.match(phpunit, /bootstrap="tests\/php\/bootstrap\.php"/);
assert.match(phpunit, /failOnEmptyTestSuite="true"/); assert.match(phpunit, /failOnEmptyTestSuite="true"/);
assert.match(phpunit, /<directory suffix="Test\.php">tests\/php<\/directory>/); assert.match(phpunit, /<directory suffix="Test\.php">tests\/php<\/directory>/);