isTestPath

tcmts.cli.testing.isTestPath · #2qk3zveu · term · runs anywhere

Tests are definitions named test… (lib.testSortIsStable, test_sort) or living under a tests namespace.

export function isTestPath(p: string): boolean {
  const last = p.slice(p.lastIndexOf(".") + 1);
  return p.split(".").includes("tests") || /^test([A-Z0-9_$]|$)/.test(last);
}

used by