Skip to main content

is_non_test_source_path

Function is_non_test_source_path 

Source
pub fn is_non_test_source_path(directory: &[u8], path: &[u8]) -> bool
Expand description

What: Whether a path is non-test source of the package in directory. Why: The file must sit under the package’s src/, end with a source extension, and its name must not contain .test.. A sibling directory sharing a prefix (package/module/ab for package/module/a) does not count.

In TS you’d write (pseudocode):

return path.startsWith(`${directory}/src/`) && SOURCE_EXTENSIONS.some(e => name.endsWith(e)) && !name.includes('.test.');