Skip to main content

Module extract

Module extract 

Source
Expand description

Test extraction for Go, Rust, C#, Java, Kotlin, TypeScript, JavaScript and Dart source files.

Structs§

ExtractedTest

Enums§

ExtractError

Constants§

TYPESCRIPT_TEST_EXTENSIONS
File extensions (without the dot) of TypeScript / JavaScript (Vitest) test files: <name>.test.<ext> / <name>.spec.<ext>.

Functions§

extract_csharp_tests
Extract C# tests (xUnit / NUnit / MSTest) from a *.cs file: methods inside types (also through namespaces and #if blocks) carrying a test attribute. Markers come from the comment block immediately preceding the method, and content runs from the first non-attribute token to the end of the method.
extract_dart_tests
Extract Dart (package:test / flutter_test) tests from a *_test.dart file: test / testWidgets call statements directly inside main or inside the callback of a group that is itself reachable that way. Markers come from the comment block immediately preceding the call, and content is the whole call statement.
extract_go_tests
Extract Go tests from a *_test.go file: top-level function_declarations whose name starts with Test. Markers are collected from the block of comments immediately (no blank line) preceding the function.
extract_java_tests
Extract Java (JUnit) tests: methods annotated with one of [JVM_TEST_ANNOTATIONS] directly inside class / record / interface / enum bodies. Markers come from the // / /* */ comment block immediately preceding the method; content starts at the first non-annotation token.
extract_kotlin_tests
Extract Kotlin (JUnit) tests: functions annotated with one of [JVM_TEST_ANNOTATIONS] at the top level or directly inside class / object / companion object bodies. Parsing uses an ASCII shadow of the source (see [KotlinShadow]); names and content come from the original.
extract_rust_tests
Extract Rust tests: function_items carrying a test attribute, i.e. an outer attribute whose path ends in test (#[test], #[tokio::test], …) or in one of extra_attributes (last path segment, e.g. rstest). Markers come from the comment block immediately preceding the first (topmost) test attribute. content is the source of the function_item (attributes not included).
extract_typescript_tests
Extract TypeScript / JavaScript (Vitest) tests from a *.test.<ext> / *.spec.<ext> file (see TYPESCRIPT_TEST_EXTENSIONS): it / test call statements at the top level or directly inside describe callbacks. Markers come from the comment block immediately preceding the call, and content is the whole call statement.
is_dart_test_file
Whether path is a Dart test file, i.e. ends with _test.dart.
is_typescript_test_file
Whether path is a TypeScript / JavaScript (Vitest) test file, i.e. ends with .test.<ext> or .spec.<ext> for one of the supported extensions.