Volt.Test.Imports (Volt v0.15.0)

Copy Markdown View Source

Handles Volt test virtual imports.

The current runner exposes the volt:test API as globals inside the QuickBEAM runtime. This module removes imports from volt:test and volt:test/browser before normal Volt compilation so users can still write idiomatic test files:

import { test, expect } from "volt:test"

test("works", () => {
  expect(1 + 1).toBe(2)
})

The rewrite is AST-backed and only removes actual import declarations whose source literal is a Volt test virtual module.

Summary

Functions

strip(source, filename)

@spec strip(String.t(), String.t()) :: {:ok, String.t()} | {:error, term()}

strip!(source, filename)

@spec strip!(String.t(), String.t()) :: String.t()