CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/golang-github-com-onsi-ginkgo-v2

A mature testing framework for Go designed to help you write expressive specs

Overall
score

97%

Overview
Eval results
Files

task.mdevals/scenario-7/

Test Environment Validator

A utility package that provides functions to conditionally control test execution based on runtime environment conditions.

Capabilities

Skip tests in CI environments

  • When running in CI (CI=true), calling SkipInCI() skips the test with message "Skipping test in CI environment" @test
  • When NOT running in CI, calling SkipInCI() allows the test to run normally @test

Skip tests based on Go version

  • When Go version is below minimum (e.g., GO_VERSION=1.19.0, minimum=1.20.0), calling SkipIfGoVersionBelow(1, 20) skips test with message "Test requires Go 1.20.0 or higher, current version: 1.19.0" @test
  • When Go version meets or exceeds minimum (e.g., GO_VERSION=1.21.3, minimum=1.20.0), calling SkipIfGoVersionBelow(1, 20) allows test to run normally @test

Require environment variables

  • When a required environment variable is not set or empty, calling RequireEnvVar("VAR_NAME") fails the test with message "Required environment variable VAR_NAME is not set" @test
  • When a required environment variable is set to any non-empty value, calling RequireEnvVar("VAR_NAME") allows the test to continue @test

Implementation

@generates

API

package validator

// SkipInCI conditionally skips the current test if running in a CI environment.
// Checks if the CI environment variable is set to "true".
// Must be called from within a test context.
func SkipInCI() {
	// Implementation here
}

// SkipIfGoVersionBelow skips the current test if the Go version is below the specified minimum.
// Reads the GO_VERSION environment variable (e.g., "1.20.5") and compares major.minor version.
// Must be called from within a test context.
func SkipIfGoVersionBelow(major, minor int) {
	// Implementation here
}

// RequireEnvVar fails the current test if the specified environment variable is not set or empty.
// Must be called from within a test context.
func RequireEnvVar(name string) {
	// Implementation here
}

Dependencies { .dependencies }

ginkgo/v2 { .dependency }

Provides BDD testing framework with programmatic test control functions.

@satisfied-by

Install with Tessl CLI

npx tessl i tessl/golang-github-com-onsi-ginkgo-v2

tile.json