Expand description
Shared classification of test paths.
Two sets of paths exist:
- Test code holds the tests: specs, test directories and end-to-end suites.
- Test support helps the tests: mocks, fixtures and snapshots.
is_test_code_path matches test code only. Use it when the question is
“does a test exist” or “did a test change”: audit test adjacency, audit
test-weakening signals and similar-code related tests.
is_test_path matches test code and test support. Use it when the
question is “is this production code”: health hotspots, the human check
split, orientation and the audit branching split.
The match is mostly syntactic and ASCII case-insensitive. A directory
segment matches by its full name, and a file-name marker matches only in
the last segment. Both / and \ separate segments, so the verdict does
not depend on the platform.
Two rules also read the file system below the project root, because the path alone is not sufficient:
- A
.cy.file is a Cypress spec only when it is a script file below acypressdirectory, or below a directory that holds a Cypress config or acypressdirectory..cy.is also the Welsh language code, sosrc/i18n/strings.cy.tsin a project without Cypress is not a test. - A
specorspecsdirectory holds tests only at a test root: the project root, a package root (a directory with apackage.json), or a directory with asrcorlibdirectory next to thespecdirectory. Asrc/spec/module is production code.
Functions§
- is_
test_ code_ path - Whether a project-relative path is test code. Test support (mocks, fixtures and snapshots) does not match, except below a test directory.
- is_
test_ code_ path_ str - Whether a project-relative path string is test code.
- is_
test_ path - Whether a project-relative path is test code or test support.
- is_
test_ path_ str - Whether a project-relative path string is test code or test support.