Volt.Test.Assertions (Volt v0.15.5)

Copy Markdown View Source

Converts Volt JavaScript test runner results into ExUnit assertions.

Summary

Functions

Runs JavaScript-like sigils as Volt test assertions.

Delegates to ExUnit's assert/2.

Runs a JavaScript or TypeScript snippet as a Volt test assertion.

Functions

assert(source)

(macro)

Runs JavaScript-like sigils as Volt test assertions.

This extends ExUnit's assert/1 for ~JS, ~TS, ~JSX, and ~TSX snippets while delegating all other expressions to ExUnit.Assertions.assert/1.

assert(source, message)

(macro)

Delegates to ExUnit's assert/2.

assert_js(source, opts \\ [])

(macro)

Runs a JavaScript or TypeScript snippet as a Volt test assertion.

The snippet body is wrapped in a single Volt test(...). Top-level import declarations are preserved outside the wrapper so snippets can import app code while keeping assertions inline in ExUnit tests.

assert_passed!(result)

@spec assert_passed!(Volt.Test.Result.t()) :: :ok