Documentation
¶
Overview ¶
Package gotest owns GoScript package-test execution.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultParallelism ¶ added in v0.1.2
func DefaultParallelism() int
DefaultParallelism returns the default package subprocess concurrency.
Types ¶
type Owner ¶
type Owner string
Owner classifies the package owner that should receive a test-runner failure.
const ( // OwnerPackageGraph classifies package pattern, build tag, or dependency graph failures. OwnerPackageGraph Owner = "PackageGraphOwner" // OwnerSemanticModel classifies Go type or semantic fact failures. OwnerSemanticModel Owner = "SemanticModelOwner" // OwnerLowering classifies unsupported Go-to-GoScript lowering failures. OwnerLowering Owner = "LoweringOwner" // OwnerTypeScriptEmitter classifies invalid emitted TypeScript failures. OwnerTypeScriptEmitter Owner = "TypeScriptEmitterOwner" // OwnerRuntimePackage classifies GoScript runtime primitive failures. OwnerRuntimePackage Owner = "RuntimePackageOwner" // OwnerOverridePackage classifies handwritten package override failures. OwnerOverridePackage Owner = "OverridePackageOwner" // OwnerTestRunner classifies generated testmain, execution, and aggregation failures. OwnerTestRunner Owner = "TestRunnerOwner" // OwnerSpacewaveHarness classifies target-ring or harness selection failures. OwnerSpacewaveHarness Owner = "SpacewaveHarnessOwner" )
type PackagePhases ¶
type PackagePhases struct {
// Workspace covers workspace files and tool discovery.
Workspace PhaseStatus
// Compile covers GoScript compile/lowering work.
Compile PhaseStatus
// Emit covers TypeScript emit/copy output work.
Emit PhaseStatus
// TypeCheck covers tsgo execution.
TypeCheck PhaseStatus
// Runtime covers Bun test execution.
Runtime PhaseStatus
}
PackagePhases records structured package-test phase status.
type PackageResult ¶
type PackageResult struct {
// PackagePath is the package under test.
PackagePath string
// SourceDir is the package source directory used as the runtime cwd.
SourceDir string
// TestPackagePath is the package variant that contains test functions.
TestPackagePath string
// TestImports are direct imports from selected test variants.
TestImports []string
// Tests are the selected tests for this package.
Tests []Test
// Action is the package result.
Action Action
// Phases records structured status for each runner phase.
Phases PackagePhases
// Owner is the primary owner classification for failures.
Owner Owner
// Error is the concise package failure message.
Error string
// Output is raw process output for the package.
Output string
// Elapsed is the package runtime.
Elapsed time.Duration
}
PackageResult describes one package-test result.
type PhaseStatus ¶
type PhaseStatus string
PhaseStatus names a package-test phase state.
const ( // PhaseStatusPending means the phase has not run yet. PhaseStatusPending PhaseStatus = "pending" // PhaseStatusPass means the phase passed. PhaseStatusPass PhaseStatus = "pass" // PhaseStatusFail means the phase failed. PhaseStatusFail PhaseStatus = "fail" // PhaseStatusSkip means the phase was skipped. PhaseStatusSkip PhaseStatus = "skip" )
type Request ¶
type Request struct {
// Dir is the working directory for package loading.
Dir string
// Patterns are Go package patterns to test.
Patterns []string
// BuildTags are normalized into a Go -tags build flag.
BuildTags []string
// OverrideDirs are additional GoScript override roots.
OverrideDirs []string
// Run is the optional Go test name regexp.
Run string
// Count is the number of times to run matched tests.
Count int
// Short reports true from testing.Short in generated tests.
Short bool
// Timeout bounds compile, typecheck, and execution.
Timeout time.Duration
// Verbose emits test-level output.
Verbose bool
// PanicOnExit0 makes os.Exit(0) fail like go test's -test.paniconexit0.
PanicOnExit0 bool
// WorkDir stores generated runner files and logs.
WorkDir string
// OutputRoot stores generated TypeScript packages.
OutputRoot string
// Parallelism limits concurrent package typecheck/runtime subprocesses.
Parallelism int
// RuntimeBackend selects the JavaScript host used for package runtime tests.
RuntimeBackend RuntimeBackend
// RuntimeGroups allows package runtimes to share worker Bun processes.
RuntimeGroups bool
// IncrementalTypeCheck reuses TypeScript build-info files inside WorkDir.
IncrementalTypeCheck bool
}
Request describes one GoScript package-test run.
type Result ¶
type Result struct {
// WorkDir is the generated test workspace.
WorkDir string
// OutputRoot is the generated TypeScript package root.
OutputRoot string
// Packages are deterministic package-level test results.
Packages []PackageResult
// Diagnostics are compiler diagnostics surfaced during the run.
Diagnostics []compiler.Diagnostic
}
Result describes one GoScript package-test run.
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
Runner owns GoScript package-test loading, compilation, typecheck, and execution.
type RuntimeBackend ¶ added in v0.2.0
type RuntimeBackend string
RuntimeBackend selects the JavaScript host used for package runtime tests.
const ( // RuntimeBackendBun runs generated package-test modules directly in Bun. RuntimeBackendBun RuntimeBackend = "bun" // RuntimeBackendBrowser runs generated package-test modules in Chromium. RuntimeBackendBrowser RuntimeBackend = "browser" )
Click to show internal directories.
Click to hide internal directories.