LemonCore.Testing.Harness (lemon_core v0.1.0)

View Source

Test harness struct containing all test resources.

Fields:

  • :tmp_dir - Temporary directory path (cleaned up on exit)
  • :store - The Store process (if started)
  • :env_vars - Map of environment variables set during test
  • :original_env - Original environment values for restoration

Summary

Functions

Builds the harness, creating temp directory and setting up environment. Returns a map suitable for use as test context.

Cleans up the harness resources.

Creates a new harness builder with defaults.

Marks the test as async or not. Affects cleanup strategy.

Sets an environment variable that will be restored after the test.

Configures whether to start the Store process. Default: false.

Sets a temporary directory for the test. If not called, a temp dir is created automatically on build.

Functions

build(builder)

Builds the harness, creating temp directory and setting up environment. Returns a map suitable for use as test context.

cleanup(harness)

Cleans up the harness resources.

new()

Creates a new harness builder with defaults.

set_async(builder, async)

Marks the test as async or not. Affects cleanup strategy.

with_env(builder, key, value)

Sets an environment variable that will be restored after the test.

with_store(builder, enabled \\ true)

Configures whether to start the Store process. Default: false.

with_tmp_dir(builder, path)

Sets a temporary directory for the test. If not called, a temp dir is created automatically on build.