domain

package
v1.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 20, 2025 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package domain defines the core types for test file representation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Inventory

type Inventory struct {
	// Files contains all parsed test files.
	Files []TestFile `json:"files"`
	// RootPath is the root directory path of the scanned project.
	RootPath string `json:"rootPath"`
}

Inventory represents a collection of test files in a project.

func (Inventory) CountTests

func (inv Inventory) CountTests() int

CountTests returns the total number of tests across all files.

type Language

type Language string

Language represents a programming language.

const (
	LanguageCpp        Language = "cpp"
	LanguageCSharp     Language = "csharp"
	LanguageGo         Language = "go"
	LanguageJava       Language = "java"
	LanguageJavaScript Language = "javascript"
	LanguageKotlin     Language = "kotlin"
	LanguagePHP        Language = "php"
	LanguagePython     Language = "python"
	LanguageRuby       Language = "ruby"
	LanguageRust       Language = "rust"
	LanguageSwift      Language = "swift"
	LanguageTypeScript Language = "typescript"
)

Supported languages for test file parsing.

type Location

type Location struct {
	// EndCol is the ending column (0-based).
	EndCol int `json:"endCol,omitempty"`
	// EndLine is the ending line number (1-based).
	EndLine int `json:"endLine"`
	// File is the file path.
	File string `json:"file"`
	// StartCol is the starting column (0-based).
	StartCol int `json:"startCol,omitempty"`
	// StartLine is the starting line number (1-based).
	StartLine int `json:"startLine"`
}

Location represents a source code location range.

type Test

type Test struct {
	// Location is the source code location of this test.
	Location Location `json:"location"`
	// Name is the test description or function name.
	Name string `json:"name"`
	// Status indicates if the test is skipped, only, etc.
	Status TestStatus `json:"status"`
	// Modifier is the original framework marker (skip, todo, fixme, @Disabled, etc.).
	Modifier string `json:"modifier,omitempty"`
}

Test represents a single test case (it, test, func TestXxx).

type TestFile

type TestFile struct {
	// Framework is the detected test framework (e.g., "jest", "vitest").
	Framework string `json:"framework"`
	// Language is the programming language of this file.
	Language Language `json:"language"`
	// Path is the file path.
	Path string `json:"path"`
	// Suites contains the test suites in this file.
	Suites []TestSuite `json:"suites,omitempty"`
	// Tests contains the top-level tests in this file (outside any suite).
	Tests []Test `json:"tests,omitempty"`
}

TestFile represents a parsed test file.

func (*TestFile) CountTests

func (f *TestFile) CountTests() int

CountTests returns the total number of tests in this file.

type TestStatus

type TestStatus string

TestStatus represents the execution behavior of a test. Maps to database ENUM: active, skipped, todo, focused, xfail

const (
	// TestStatusActive indicates a normal test that runs and expects success.
	TestStatusActive TestStatus = "active"
	// TestStatusSkipped indicates a test intentionally excluded from execution.
	TestStatusSkipped TestStatus = "skipped"
	// TestStatusTodo indicates a test not yet implemented.
	TestStatusTodo TestStatus = "todo"
	// TestStatusFocused indicates a debugging-only test (.only, fit).
	// CI should warn when focused tests are committed.
	TestStatusFocused TestStatus = "focused"
	// TestStatusXfail indicates a test expected to fail (pytest xfail, RSpec pending).
	TestStatusXfail TestStatus = "xfail"
)

Test status values aligned with DB schema.

type TestSuite

type TestSuite struct {
	// Location is the source code location of this suite.
	Location Location `json:"location"`
	// Name is the suite description.
	Name string `json:"name"`
	// Status indicates if the suite is skipped, only, etc.
	Status TestStatus `json:"status"`
	// Modifier is the original framework marker (skip, todo, fixme, @Disabled, etc.).
	Modifier string `json:"modifier,omitempty"`
	// Suites contains nested test suites.
	Suites []TestSuite `json:"suites,omitempty"`
	// Tests contains the tests in this suite.
	Tests []Test `json:"tests,omitempty"`
}

TestSuite represents a test suite (describe, test.describe).

func (*TestSuite) CountTests

func (s *TestSuite) CountTests() int

CountTests returns the total number of tests in this suite including nested suites.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL