LiveStyle.TestCase (LiveStyle v0.13.1)
View SourceBase test case for LiveStyle tests.
This module provides a consistent test environment with:
- Isolated manifest per test (for async test safety)
Usage
defmodule MyTest do
use LiveStyle.TestCase
test "example" do
css = LiveStyle.Compiler.generate_css()
end
endHow Test Isolation Works
Each test process receives its own copy of the manifest via Storage.fork/0.
This ensures:
- Tests can modify the manifest without affecting other tests
- The shared manifest file remains pristine for module compilation
- No race conditions between test execution and test file loading
Options
:async- Whether tests can run in parallel (default:true)
Configuration
All LiveStyle configuration is compile-time only (like StyleX's Babel plugin config). Set configuration in config/config.exs or config/test.exs:
config :live_style,
class_name_prefix: "x",
use_css_layers: false,
debug_class_names: true