From 7cb244d3d9527aa1c054b73cd67e7b9814bf4133 Mon Sep 17 00:00:00 2001 From: Amaad Martin Date: Fri, 31 Jul 2026 15:51:53 -0700 Subject: [PATCH 1/2] Test: fail CI when a root test script targets a vitest project no workflow runs Nothing today proves the test scripts in the root package.json are actually executed by a GitHub Actions workflow. Dropping a --project flag from test:coverage, or adding a test:* script nobody wires into a workflow, leaves CI green while those tests silently stop running. The integration project hosts the repo's own meta-guards, so that failure mode hides itself. Add a dependency-free guard that walks root test script -> vitest project -> workflow step by reading package.json and .github/workflows/*.{yml,yaml}, and fails naming both the orphaned project and the script that declares it. --- .../repo_config/workflow_scripts_test.ts | 160 ++++++++++++++++++ 1 file changed, 160 insertions(+) create mode 100644 tests/integration/repo_config/workflow_scripts_test.ts diff --git a/tests/integration/repo_config/workflow_scripts_test.ts b/tests/integration/repo_config/workflow_scripts_test.ts new file mode 100644 index 000000000..ef4ac48b0 --- /dev/null +++ b/tests/integration/repo_config/workflow_scripts_test.ts @@ -0,0 +1,160 @@ +/** + * @license + * Copyright 2026 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +import * as fs from 'node:fs/promises'; +import * as path from 'node:path'; +import {fileURLToPath} from 'node:url'; +import {describe, expect, it} from 'vitest'; +import rootPackage from '../../../package.json' with {type: 'json'}; + +const WORKFLOWS_DIR = path.resolve( + path.dirname(fileURLToPath(import.meta.url)), + '../../../.github/workflows', +); + +/** A GitHub Actions workflow file: `.yml` or `.yaml`. */ +const WORKFLOW_FILE_PATTERN = /\.ya?ml$/; + +/** `npm run