ActorSimulation.GeneratorMetadata (GenServerVirtualTime v0.6.0)

Copy Markdown View Source

Utilities for tracking which test file/function generated an HTML report.

This helps maintain traceability between generated reports and their source code.

Summary

Functions

Extracts generator metadata from the current stack trace.

Generates an HTML comment with generator metadata.

Functions

from_stacktrace()

Extracts generator metadata from the current stack trace.

Returns a map with :test_file, :test_name, and :generator_function keys, or nil if not called from a test.

Example

metadata = GeneratorMetadata.from_stacktrace()
# => %{
#   test_file: "test/mermaid_report_test.exs",
#   test_name: "generates pipeline report",
#   generator_function: "ActorSimulation.MermaidReportGenerator.generate_report/2"
# }

to_html_comment(metadata)

Generates an HTML comment with generator metadata.

Example

comment = GeneratorMetadata.to_html_comment(metadata)
# => "<!--\n  Generated by: test/mermaid_report_test.exs\n  Test: generates pipeline report\n  Generator: ActorSimulation.MermaidReportGenerator.generate_report/2\n-->\n"