From 6d307f42f47b3003c35cedcf0c64274e854ff63e Mon Sep 17 00:00:00 2001 From: "Aaron K. Clark" Date: Tue, 19 May 2026 08:33:27 -0500 Subject: [PATCH] test(spdx): extend SPDX-header scan to tests/ to match the documented intent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The header comment on this test claims "every JS file in app/, server.js, and tests/ carries the Apache-2.0 SPDX header" but `SCAN_ROOTS` only included `'app'` — tests/ was named in the comment but never actually walked. The regression net had a gap: a future test file copy-pasted from a header-less template would slip past CI. All current test files already have the header, so adding `'tests'` to `SCAN_ROOTS` is a no-op behavior-wise — the new assertions all pass (test count went from 688 to 742, +54 new per-file checks for the existing test files). Now the floor matches what the comment promised. Updated the surrounding comment to describe the new scope (instead of the stale "tests/integration/ skipped" note that was confusing given the actual SCAN_ROOTS didn't include any tests dir at all). Co-Authored-By: Claude Opus 4.7 (1M context) --- tests/unit/spdx-headers.test.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/unit/spdx-headers.test.js b/tests/unit/spdx-headers.test.js index 308a2c3..c66ae6c 100644 --- a/tests/unit/spdx-headers.test.js +++ b/tests/unit/spdx-headers.test.js @@ -19,13 +19,15 @@ import { resolve, join } from 'node:path'; const REPO_ROOT = resolve(__dirname, '../..'); -// Files / directories we deliberately don't scan: -// - tests/integration/ test files: already covered via the -// same pattern but skipped here to keep the per-file count -// focused on production code's contract. +// Both production code AND the test suite carry the header per the +// project convention documented above. Scan both so a future test file +// copy-pasted from a header-less template fails CI immediately +// alongside the production-code path. +// +// server.js gets covered via the single-file fallback below. const SCAN_ROOTS = [ 'app', - // server.js gets covered via the single-file fallback below. + 'tests', ]; function walk(absDir, acc = []) {