domain

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 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 (
	LanguageTypeScript Language = "typescript"
	LanguageJavaScript Language = "javascript"
	LanguageGo         Language = "go"
)

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"`
}

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 status of a test.

const (
	// TestStatusFixme indicates a test marked with .fixme (Playwright).
	TestStatusFixme TestStatus = "fixme"
	// TestStatusOnly indicates a test marked to run exclusively (.only).
	TestStatusOnly TestStatus = "only"
	// TestStatusPending indicates a test without implementation.
	TestStatusPending TestStatus = "pending"
	// TestStatusSkipped indicates a test marked to skip (.skip, xit, etc.).
	TestStatusSkipped TestStatus = "skipped"
)

Test status values.

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"`
	// 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