Commands: test

Tests run the suites on the cells you select. A quick run skips a suite whose inputs have not changed. A full run does not. Watch reruns a command when you save a file.

histos.testrun.TestMode.token
def token: String = this match
    case Run   => "run"
    case Quick => "quick"
histos.cli.AffectedChoice.selection
def selection(
      projects: List[ProjectName],
      choice: AffectedChoice,
      platforms: PlatformSelection,
      versions: ScalaSelection = ScalaSelection.All,
  ): TestSelection =
    val targets = projects match
      case Nil           => TestTargets.All
      case first :: rest => TestTargets.Named(first, rest)
    def applyChoice(base: TestTargets, choice: AffectedChoice): TestSelection = choice match
      case AffectedChoice.Unset | AffectedChoice.Everything => TestSelection(base, platforms, scala = versions)
      case AffectedChoice.NoneSelected                      => TestSelection(base, platforms, Some(Nil), versions)
      case AffectedChoice.Only(modules)                     => TestSelection(base, platforms, Some(modules), versions)
      case AffectedChoice.Within(eligible, affected)        =>
        base match
          case TestTargets.All               => applyChoice(TestTargets.Filtered(eligible), affected)
          case TestTargets.Filtered(modules) =>
            applyChoice(TestTargets.Filtered(modules.filter(eligible.contains)), affected)
          case TestTargets.Named(_, _) =>
            val selected = applyChoice(base, affected)
            selected.copy(affected = Some(eligible.filter(name => selected.affected.forall(_.contains(name)))))
    applyChoice(targets, choice)

test

histos test runs the suites. Name projects to limit which modules run. --quick skips a suite whose stamp still matches, which is the run you want while editing. A full histos test runs every selected suite.

--only selects suites by pattern. --test matches substrings of test labels, --tag keeps tests with any listed exact tag, and --ignore-tag drops tests with any listed tag. A filter does not turn a skipped suite back on under --quick.

These filters, --platform, and --scala accept repeated flags and comma lists, before or after projects. --scala takes a series (2.13 or 3) or a full version. A named module refuses a token that matches nothing and a series that matches two versions. A whole-build request keeps every matching cell. Omission is every declared version. When the run covers more than one full version, the tally prints one line per version before the combined line. Each flag consumes one value. Empty entries fail. Escape a literal comma as \, and a backslash as \\, quoting for the shell: histos test core --platform jvm --scala 2.13 --only '*Parser*,*Codec*' --tag 'db\,local'.

--affected <json> intersects the original selection with changed modules. It stays a JSON list, not a comma list. --suite <json> supplies whole-suite CI eligibility; it cannot combine with named projects and does not turn a singleton into a focused request. Whole-suite requests exclude Verify modules and unsupported platforms. Explicitly named unsupported platforms still fail, even if the affected list is empty. Compilation prerequisites, including upstream Test fixtures, are built as needed, but their suites do not run unless selected.

histos.TextList.parse(List("db\\,local,remote", "remote"))
Right(List(db,local, remote))

coverage

histos coverage instruments Scala on the JVM, runs the suites, and writes a coverage report. --scala selects versions the same way histos test does. --platform must be jvm; omission stays on the JVM. The --min-stmt and --min-branch flags set a floor for the whole run, and the -file and -package forms set a floor for each file or each package. The run fails when a floor is missed. --exclude-class and --exclude-file take regular expressions for code you do not want measured.

affected

histos affected --base <sha> prints the modules whose sources differ from that commit. You use the list to decide what to test, or you pass it to histos test --affected.

One native test binary

Linking a Native test binary is the slow part of a native suite. When several native modules should run as one binary, give one module testAggregate and name the others. histos test nativeTests --platform native selects its members, compiles their tests, links once, and runs once. Whole-suite or multi-module requests also use that aggregate when every member is selected for the same Scala version. A focused histos test core --platform native stays direct, even for a one-member group. Partial groups and unmatched Scala versions stay direct too. An affected mask does not pull unselected suites back into a group.

The aggregating module builds Native, it is not published, and it can have no sources of its own. A member that does not build Native is refused when the build file compiles.

val nativeTests = module("nativeTests", Native)(scala"3.8.1")
  .clang(ClangMajor(21))
  .testAggregate(core, wire)
histos.Module.testAggregates
testAggregates: List[ProjectName] = Nil

Browser suites

A suite that opens a browser does not belong in histos test. Mark that module lane(TestLane.Verify). A plain histos test skips it. histos test browsers runs it, and a verify job can run that same command.

The JVM child receives the system properties you put on the test provider. Chekhov reads chekhov.browsers. The generated job installs the browsers RunnerTools names. Firefox is the one you get when you name none.

val browsers = module("browsers", Jvm)(scala"3.8.1")
  .lane(TestLane.Verify)
  .testProvider(
    TestProvider.Zio.properties(SystemProperty("chekhov.browsers=chromium,firefox,webkit"))
  )
histos.SystemProperty$package.SystemProperty.from
def from(raw: String): Either[SystemPropertyError, SystemProperty] =
    if raw.isEmpty then Left(SystemPropertyError.Empty)
    else if Shape.matches(raw) then Right(trusted(raw))
    else Left(SystemPropertyError.Malformed(raw))
histos.Browser.token
def token: String = this match
    case Chromium => "chromium"
    case Firefox  => "firefox"
    case WebKit   => "webkit"

watch

histos ~ <command> runs the command, then runs it again after you save a source. histos ~ test is the usual loop. histos ~ --restart run <name> restarts the program when the compile succeeds, instead of leaving the old process up.