Documentation
¶
Index ¶
- Constants
- Variables
- func AddSuiteToTarget(suite domain.TestSuite, parentSuite *domain.TestSuite, file *domain.TestFile)
- func AddTestToTarget(test domain.Test, parentSuite *domain.TestSuite, file *domain.TestFile)
- func DetectLanguage(filename string) domain.Language
- func ExtractArrayContent(node *sitter.Node, source []byte) string
- func ExtractArrayElements(arrayNode *sitter.Node, source []byte) []string
- func ExtractEachTestCases(args *sitter.Node, source []byte) []string
- func ExtractTestName(args *sitter.Node, source []byte) string
- func FindCallback(args *sitter.Node) *sitter.Node
- func FormatEachName(template, data string) string
- func IsTestFile(filename string) bool
- func Parse(ctx context.Context, source []byte, filename string, framework string) (*domain.TestFile, error)
- func ParseCallbackBody(callback *sitter.Node, source []byte, filename string, file *domain.TestFile, ...)
- func ParseFunctionName(node *sitter.Node, source []byte) (string, domain.TestStatus, string)
- func ParseIdentifierFunction(node *sitter.Node, source []byte) (string, domain.TestStatus, string)
- func ParseMemberExpressionFunction(node *sitter.Node, source []byte) (string, domain.TestStatus, string)
- func ParseModifierStatus(modifier string) domain.TestStatus
- func ParseNestedMemberExpression(obj, prop *sitter.Node, source []byte) (string, domain.TestStatus, string)
- func ParseNode(node *sitter.Node, source []byte, filename string, file *domain.TestFile, ...)
- func ParseSimpleMemberExpression(obj, prop *sitter.Node, source []byte) (string, domain.TestStatus, string)
- func ProcessCallExpression(node *sitter.Node, source []byte, filename string, file *domain.TestFile, ...)
- func ProcessEachCall(outerCall, innerCall, outerArgs *sitter.Node, source []byte, filename string, ...)
- func ProcessEachSuites(callNode *sitter.Node, testCases []string, nameTemplate string, ...)
- func ProcessEachTests(callNode *sitter.Node, testCases []string, nameTemplate string, ...)
- func ProcessSuite(callNode *sitter.Node, args *sitter.Node, source []byte, filename string, ...)
- func ProcessTest(callNode *sitter.Node, args *sitter.Node, source []byte, filename string, ...)
- func ResolveEachNames(template string, testCases []string) []string
- func UnquoteString(text string) string
Constants ¶
const ( FuncDescribe = "describe" FuncIt = "it" FuncTest = "test" ModifierSkip = "skip" ModifierOnly = "only" ModifierEach = "each" ModifierTodo = "todo" DynamicCasesSuffix = " (dynamic cases)" )
Variables ¶
var FocusedFunctionAliases = map[string]string{ "fdescribe": FuncDescribe, "fit": FuncIt, }
var JestPlaceholderPattern = regexp.MustCompile(`%[sdpji#%]`)
var SkippedFunctionAliases = map[string]string{ "xdescribe": FuncDescribe, "xit": FuncIt, "xtest": FuncTest, }
Functions ¶
func AddSuiteToTarget ¶
AddSuiteToTarget adds a suite to the appropriate parent (suite or file).
func AddTestToTarget ¶
AddTestToTarget adds a test to the appropriate parent (suite or file).
func DetectLanguage ¶
DetectLanguage determines the programming language based on file extension.
func ExtractArrayElements ¶
func FormatEachName ¶
func IsTestFile ¶
func Parse ¶
func Parse(ctx context.Context, source []byte, filename string, framework string) (*domain.TestFile, error)
Parse is the main entry point for parsing JavaScript/TypeScript test files.
func ParseCallbackBody ¶
func ParseCallbackBody(callback *sitter.Node, source []byte, filename string, file *domain.TestFile, suite *domain.TestSuite)
ParseCallbackBody parses the body of a callback function.
func ParseFunctionName ¶
func ParseIdentifierFunction ¶
func ParseModifierStatus ¶
func ParseModifierStatus(modifier string) domain.TestStatus
func ParseNode ¶
func ParseNode(node *sitter.Node, source []byte, filename string, file *domain.TestFile, currentSuite *domain.TestSuite)
ParseNode recursively traverses the AST to find and process test definitions.
func ProcessCallExpression ¶
func ProcessCallExpression(node *sitter.Node, source []byte, filename string, file *domain.TestFile, currentSuite *domain.TestSuite)
ProcessCallExpression processes a call expression node to extract test/suite definitions.
func ProcessEachCall ¶
func ProcessEachCall(outerCall, innerCall, outerArgs *sitter.Node, source []byte, filename string, file *domain.TestFile, currentSuite *domain.TestSuite)
ProcessEachCall handles .each() call patterns for both describe and test/it.
func ProcessEachSuites ¶
func ProcessEachSuites(callNode *sitter.Node, testCases []string, nameTemplate string, callback *sitter.Node, source []byte, filename string, file *domain.TestFile, parentSuite *domain.TestSuite, status domain.TestStatus, modifier string)
ProcessEachSuites creates multiple suites from a describe.each() call.
func ProcessEachTests ¶
func ProcessEachTests(callNode *sitter.Node, testCases []string, nameTemplate string, filename string, file *domain.TestFile, parentSuite *domain.TestSuite, status domain.TestStatus, modifier string)
ProcessEachTests creates multiple tests from a .each() call.
func ProcessSuite ¶
func ProcessSuite(callNode *sitter.Node, args *sitter.Node, source []byte, filename string, file *domain.TestFile, parentSuite *domain.TestSuite, status domain.TestStatus, modifier string)
ProcessSuite creates a test suite from a call expression. Handles both regular suites with callbacks and pending suites without callbacks.
func ProcessTest ¶
func ProcessTest(callNode *sitter.Node, args *sitter.Node, source []byte, filename string, file *domain.TestFile, parentSuite *domain.TestSuite, status domain.TestStatus, modifier string)
ProcessTest creates a test from a call expression.
func ResolveEachNames ¶
ResolveEachNames generates test names from a template and test cases.
func UnquoteString ¶
Types ¶
This section is empty.