startest/locator

Types

A file that contains tests.

pub type TestFile {
  TestFile(
    module_name: String,
    filepath: String,
    tests: List(TestTree),
    collect_duration: Duration,
  )
}

Constructors

  • TestFile(
      module_name: String,
      filepath: String,
      tests: List(TestTree),
      collect_duration: Duration,
    )

    Arguments

    • module_name

      The name of the Gleam module.

    • filepath

      The filepath to the .gleam file.

    • tests

      The list of tests in the file.

    • collect_duration

      The time it took to collect the tests in the file.

pub type TestFunction {
  TestFunction(
    module_name: String,
    name: String,
    body: fn() -> Dynamic,
  )
}

Constructors

  • TestFunction(
      module_name: String,
      name: String,
      body: fn() -> Dynamic,
    )

A file in the test/ directory that likely contains tests.

pub type TestSourceFile {
  TestSourceFile(
    module_name: String,
    filepath: String,
    tests: List(TestFunction),
  )
}

Constructors

  • TestSourceFile(
      module_name: String,
      filepath: String,
      tests: List(TestFunction),
    )

    Arguments

    • module_name

      The name of the Gleam module.

    • filepath

      The filepath to the .gleam file.

    • tests

      The list of tests in the file.

Functions

pub fn identify_tests(
  test_files: List(TestSourceFile),
  ctx: Context,
) -> List(TestFile)

Identifies all of the tests contained in the given list of TestSourceFiles.

Any files that don’t have any tests will be excluded from the result.

pub fn locate_test_files(
  ctx: Context,
) -> Result(List(TestSourceFile), Nil)

Returns the list of files in the test/ directory.

Search Document