From ae81e90b6e77932783cd8827f1581c3b9fee93a6 Mon Sep 17 00:00:00 2001 From: Steve Larson <9larsons@gmail.com> Date: Mon, 25 May 2026 12:00:45 -0500 Subject: [PATCH 1/2] Removed test:unit scripts from projects with no Vitest unit tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - apps/signup-form's test:unit ran 'pnpm build' (not tests). Its only file in test/unit/ was an empty hello.test.js that never executed. Removed both. - apps/sodo-search's test:unit ran vitest run --coverage against zero unit test files. Its Playwright tests live under test:acceptance and are unaffected. Removed test:unit and the test:ci script it chained through. - ghost-admin's test:unit was 'true' (no-op). ghost-admin's actual tests run via 'ember exam' under its own test target, invoked by the dedicated ghost-admin CI job. nx run-many -t test:unit now skips these three projects (16 → 13). Adding tests later means adding the script back — one line — and nx picks them up automatically. Bumped signup-form and sodo-search versions for the app-version-bump check; ghost-admin is not in MONITORED_APPS so no bump needed. --- apps/signup-form/package.json | 3 +-- apps/signup-form/test/unit/hello.test.js | 0 apps/sodo-search/package.json | 4 +--- ghost/admin/package.json | 1 - 4 files changed, 2 insertions(+), 6 deletions(-) delete mode 100644 apps/signup-form/test/unit/hello.test.js diff --git a/apps/signup-form/package.json b/apps/signup-form/package.json index f1f04863f95..03330d789a7 100644 --- a/apps/signup-form/package.json +++ b/apps/signup-form/package.json @@ -1,6 +1,6 @@ { "name": "@tryghost/signup-form", - "version": "0.3.26", + "version": "0.3.27", "license": "MIT", "repository": "https://github.com/TryGhost/Ghost", "author": "Ghost Foundation", @@ -20,7 +20,6 @@ "build": "tsc && vite build", "lint": "pnpm run lint:js", "lint:js": "eslint --ext .js,.ts,.cjs,.tsx --cache src test", - "test:unit": "pnpm build", "test:acceptance": "NODE_OPTIONS='--experimental-specifier-resolution=node --no-warnings' VITE_TEST=true playwright test", "test:acceptance:slowmo": "TIMEOUT=100000 PLAYWRIGHT_SLOWMO=100 pnpm test:acceptance --headed", "test:acceptance:full": "ALL_BROWSERS=1 pnpm test:acceptance", diff --git a/apps/signup-form/test/unit/hello.test.js b/apps/signup-form/test/unit/hello.test.js deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/apps/sodo-search/package.json b/apps/sodo-search/package.json index 329189ee6a7..735c5823ae4 100644 --- a/apps/sodo-search/package.json +++ b/apps/sodo-search/package.json @@ -1,6 +1,6 @@ { "name": "@tryghost/sodo-search", - "version": "1.8.20", + "version": "1.8.21", "license": "MIT", "repository": "https://github.com/TryGhost/Ghost", "author": "Ghost Foundation", @@ -27,8 +27,6 @@ "tailwind": "pnpm tailwind:base --watch ", "tailwind:base": "tailwindcss -i ./src/index.css -o ./umd/main.css --minify", "test": "vitest run", - "test:ci": "pnpm test --coverage", - "test:unit": "pnpm test:ci", "lint": "eslint src --ext .js --cache", "preship": "pnpm lint", "ship": "node ../../.github/scripts/release-apps.js", diff --git a/ghost/admin/package.json b/ghost/admin/package.json index d709d81dc05..ea88ab261f6 100644 --- a/ghost/admin/package.json +++ b/ghost/admin/package.json @@ -19,7 +19,6 @@ "dev": "ember serve", "build": "ember build --environment=production --silent", "build:dev": "pnpm build --environment=development", - "test:unit": "true", "test": "ember exam --split 2 --parallel", "lint:js": "eslint . --cache", "lint:hbs": "ember-template-lint .", From 27a1c60d7f7df801c1a3c5d8459d4ed46db46693 Mon Sep 17 00:00:00 2001 From: Steve Larson <9larsons@gmail.com> Date: Mon, 25 May 2026 15:04:35 -0500 Subject: [PATCH 2/2] Changed Vitest config CI unit test coverage ref https://github.com/TryGhost/Ghost/pull/28115 Shared Vitest config changes can affect more tests than Nx marks as changed, so CI now widens unit-test project selection for root config changes while keeping Ghost core config changes scoped to Ghost core. --- .github/workflows/ci.yml | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 994a3b49ae2..dd69831e140 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -122,6 +122,11 @@ jobs: tinybird-datafiles: - 'ghost/core/core/server/data/tinybird/**' - '!ghost/core/core/server/data/tinybird/**/*.md' + unit-test-globals: + - 'vitest.config.mjs' + core-unit-test-globals: + - 'ghost/core/vitest.config.ts' + - 'ghost/core/test/utils/vitest-*.ts' any-code: - '!**/*.md' - '!.devcontainer/**' @@ -172,6 +177,16 @@ jobs: AFFECTED_PROJECTS_STR=$(pnpm -s nx show projects ${AFFECTED_ARG} --sep=, | tr -d '\n') echo "affected_projects_str=$AFFECTED_PROJECTS_STR" >> "$GITHUB_OUTPUT" + UNIT_TEST_AFFECTED_ARG="$AFFECTED_ARG" + if [[ "${{ steps.changed.outputs.unit-test-globals }}" == 'true' ]]; then + UNIT_TEST_AFFECTED_ARG="" + fi + UNIT_TEST_PROJECTS_STR=$(pnpm -s nx show projects ${UNIT_TEST_AFFECTED_ARG} --withTarget test:unit --sep=, | tr -d '\n') + if [[ "${{ steps.changed.outputs.core-unit-test-globals }}" == 'true' ]]; then + UNIT_TEST_PROJECTS_STR=$(printf '%s\n%s\n' "$UNIT_TEST_PROJECTS_STR" "ghost" | awk 'NF && !seen[$0]++' | paste -sd, -) + fi + echo "unit_test_projects_str=$UNIT_TEST_PROJECTS_STR" >> "$GITHUB_OUTPUT" + # "i18n" tag = packages whose source is scanned by @tryghost/i18n's # translate:* scripts (not packages that merely import @tryghost/i18n). I18N_PROJECTS=$(pnpm -s nx show projects ${AFFECTED_ARG} --projects 'tag:i18n' --sep=, | tr -d '\n') @@ -186,6 +201,7 @@ jobs: outputs: affected_projects: ${{ steps.affected.outputs.affected_projects }} affected_projects_str: ${{ steps.affected.outputs.affected_projects_str }} + unit_test_projects_str: ${{ steps.affected.outputs.unit_test_projects_str }} affected_playwright_projects: ${{ steps.affected.outputs.affected_playwright_projects }} changed_i18n_apps: ${{ steps.affected.outputs.affected_i18n_projects != '' }} changed_core: ${{ steps.changed.outputs.core }} @@ -353,7 +369,7 @@ jobs: job_unit-tests: runs-on: ubuntu-latest needs: [job_setup] - if: needs.job_setup.outputs.is_tag == 'true' || needs.job_setup.outputs.affected_projects_str != '' + if: needs.job_setup.outputs.is_tag == 'true' || needs.job_setup.outputs.unit_test_projects_str != '' strategy: matrix: node: ${{ fromJSON(needs.job_setup.outputs.node_test_matrix) }} @@ -393,7 +409,7 @@ jobs: # until the vitest worker/teardown issue is fixed. run: | for attempt in 1 2 3; do - pnpm nx run-many -t test:unit -p "${{ needs.job_setup.outputs.affected_projects_str }}" && exit 0 + pnpm nx run-many -t test:unit -p "${{ needs.job_setup.outputs.unit_test_projects_str }}" && exit 0 if [ "${attempt}" -lt 3 ]; then echo "::warning::Unit tests attempt ${attempt} failed — retrying" else