From d23d0694eaf58693bc5a502dde3ac087c2e8e4c8 Mon Sep 17 00:00:00 2001 From: Koji Wakayama Date: Sat, 15 Aug 2026 23:24:17 +0200 Subject: [PATCH] Keep runtime test filters type-checkable PR #3743 merged before this type-only helper annotation reached the PR head. Deno infers the JavaScript helper's default include and exclude arrays as never[] without an exported contract, so TypeScript callers fail when passing the shared Deno-only string pattern list. Adding JSDoc on filterTestFiles records the runtime shape that the helper already accepts without changing behavior. Constraint: Follow-up is limited to tests/test-file-utils.mjs JSDoc typing for the runtime-test-filters diagnostic missed by merged #3743. Rejected: Changing tests/runtime-test-filters.test.ts call sites | would hide the helper's exported type gap instead of fixing it. Rejected: Rewriting the helper in TypeScript | unnecessary and broader than a type-only repair. Confidence: high Scope-risk: narrow Directive: Keep filterTestFiles include and exclude filters typed as string-array glob patterns for all runtime test runners. Tested: deno 2.7.7 check tests/runtime-test-filters.test.ts Tested: deno 2.7.7 test tests/runtime-test-filters.test.ts with repo preload and runtime env Tested: deno 2.7.7 task fmt:check; deno 2.7.7 task lint:ci; deno 2.7.7 task typecheck Not-tested: External CI before draft PR creation --- tests/test-file-utils.mjs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/test-file-utils.mjs b/tests/test-file-utils.mjs index 71ad803051..de3a7f86ba 100644 --- a/tests/test-file-utils.mjs +++ b/tests/test-file-utils.mjs @@ -165,6 +165,12 @@ export function splitIntoShards(files, shardCount) { return shards; } +/** + * @param {string[]} files + * @param {{ include?: string[]; exclude?: string[] }} [filters] + * @param {string} [cwd] + * @returns {string[]} + */ export function filterTestFiles(files, { include = [], exclude = [] } = {}, cwd = process.cwd()) { if (files.length === 0) return []; const includeMatchers = include.map((pattern) => globToRegex(toPosixPath(pattern)));