Volt.Test.Lines (Volt v0.21.0)

Copy Markdown View Source

Extracts source line numbers for JavaScript test declarations.

Runtime collection owns JS semantics such as nested describe names and hooks. This module adds source locations with OXC so generated ExUnit tests can point at useful file lines without hand-parsing JavaScript.

Summary

Functions

Return the source line of every test in source, in the order the runtime registers them.

Functions

test_lines(source, filename)

@spec test_lines(String.t(), String.t()) :: {:ok, [pos_integer()]} | {:error, term()}

Return the source line of every test in source, in the order the runtime registers them.

test.each and describe.each register one test per case, so their lines repeat once per case. Returns {:error, :dynamic_cases} when the cases are not an array literal and the number of tests cannot be read from the source.