LivebookTest.Discovery (livebook_test v0.1.0)

Copy Markdown View Source

Notebook discovery via filesystem glob patterns.

Uses Path.wildcard/2 to find .livemd files matching configured path patterns, then excludes any matching exclusion patterns. This module is the first stage in the LivebookTest pipeline:

Discovery  Exporter  DependencyPatcher  Runner  Report

How notebook discovery works

  1. A list of glob patterns is provided (from config or CLI)
  2. Each pattern is expanded using Path.wildcard/2
  3. Results are deduplicated and sorted for deterministic execution
  4. Only files ending in .livemd are included
  5. Files matching any exclusion pattern are removed

Exclusion

The exclude option filters out notebooks that should not be run by default — for example, intentionally broken notebooks kept as test fixtures:

LivebookTest.Discovery.find(["examples/**/*.livemd"],
  exclude: ["**/broken/**/*.livemd"]
)

Examples

iex> paths = LivebookTest.Discovery.find(["examples/**/*.livemd"])
iex> is_list(paths)
true

Summary

Types

Result of discovery: a list of paths to .livemd files

Functions

Counts discovered notebooks without returning the full list.

Discovers Livebook notebooks matching the given glob patterns, excluding any that match the exclusion patterns.

Types

discovery_result()

@type discovery_result() :: [Path.t()]

Result of discovery: a list of paths to .livemd files

Functions

count(patterns, opts \\ [])

@spec count(
  [String.t()],
  keyword()
) :: non_neg_integer()

Counts discovered notebooks without returning the full list.

Useful for quick status checks or summary reporting.

Examples

iex> LivebookTest.Discovery.count(["nonexistent/**/*.livemd"])
0

find(patterns, opts \\ [])

@spec find(
  [String.t()],
  keyword()
) :: discovery_result()
@spec find(
  String.t(),
  keyword()
) :: discovery_result()

Discovers Livebook notebooks matching the given glob patterns, excluding any that match the exclusion patterns.

Returns a sorted, deduplicated list of paths.

Examples

iex> LivebookTest.Discovery.find(["nonexistent/**/*.livemd"])
[]

iex> paths = LivebookTest.Discovery.find(["examples/**/*.livemd"])
iex> Enum.all?(paths, &String.ends_with?(&1, ".livemd"))
true