### child_spec(init_arg) Source: https://hexdocs.pm/junit_formatter/JUnitFormatter.html Returns a specification to start this module under a supervisor. ```APIDOC ## child_spec(init_arg) ### Description Returns a specification to start this module under a supervisor. See `Supervisor` for more details. ### Parameters - **init_arg** (any) - Required - The initialization argument for the supervisor. ``` -------------------------------- ### Configure JUnitFormatter in config.exs Source: https://hexdocs.pm/junit_formatter/readme.html Example configuration for setting report file paths, directory locations, and XML output preferences. ```elixir config :junit_formatter, report_file: "report_file_test.xml", report_dir: "/tmp", print_report_file: true, prepend_project_name?: true, include_filename?: truecopy ``` -------------------------------- ### Configure JUnitFormatter in config.exs Source: https://hexdocs.pm/junit_formatter/index.html Example configuration block for setting custom report file paths and formatting options. ```elixir config :junit_formatter, report_file: "report_file_test.xml", report_dir: "/tmp", print_report_file: true, prepend_project_name?: true, include_filename?: true ``` -------------------------------- ### JUnit XML Report Output Source: https://hexdocs.pm/junit_formatter/readme.html Example of the generated XML structure produced by the formatter. ```xml ``` -------------------------------- ### Get report file path Source: https://hexdocs.pm/junit_formatter/JUnitFormatter.html Retrieves the full path for the generated XML report, configurable via report_dir and report_file settings. ```elixir @spec get_report_file_path() :: String.t() ``` -------------------------------- ### Run Tests Source: https://hexdocs.pm/junit_formatter/readme.html Execute tests using the standard Mix command. ```text .... Finished in 0.1 seconds (0.07s on load, 0.08s on tests) 4 tests, 0 failures Randomized with seed 600810 ``` -------------------------------- ### Configure project directory path Source: https://hexdocs.pm/junit_formatter/readme.html Sets the base directory for test file paths in the report relative to the umbrella root. ```elixir config :junit_formatter, project_dir: Path.expand("..", __DIR__) ``` -------------------------------- ### Configure ExUnit Formatter Source: https://hexdocs.pm/junit_formatter/readme.html Register the formatter in your test helper file. You can use it exclusively or alongside the default CLI formatter. ```elixir ExUnit.configure formatters: [JUnitFormatter] ExUnit.start ``` ```elixir ExUnit.configure formatters: [JUnitFormatter, ExUnit.CLIFormatter] ExUnit.start ``` -------------------------------- ### Add Dependency to mix.exs Source: https://hexdocs.pm/junit_formatter/readme.html Include the library in your project dependencies, restricted to the test environment. ```elixir defp deps do [ {:junit_formatter, "~> 3.4", only: [:test]} ] end ``` -------------------------------- ### Configure report directory Source: https://hexdocs.pm/junit_formatter/readme.html Sets a custom directory for generated XML reports. ```elixir config :junit_formatter, report_dir: "/tmp" ``` -------------------------------- ### format_time(time) Source: https://hexdocs.pm/junit_formatter/JUnitFormatter.html Formats time from nanoseconds to seconds. ```APIDOC ## format_time(time) ### Description Converts a time value from nanoseconds to a formatted string in seconds. ### Parameters - **time** (integer) - Required - The time in nanoseconds. ### Returns - **binary** - The formatted time string. ``` -------------------------------- ### Format time for JUnit report Source: https://hexdocs.pm/junit_formatter/JUnitFormatter.html Converts time from nanoseconds to a seconds-based binary format. ```elixir @spec format_time(integer()) :: binary() ``` -------------------------------- ### get_report_file_path() Source: https://hexdocs.pm/junit_formatter/JUnitFormatter.html Retrieves the full path of the generated JUnit report file. ```APIDOC ## get_report_file_path() ### Description Helper function to get the full path of the generated report file. It respects configurations for the directory and filename. ### Configuration Options - **report_dir** (string) - Optional - Full path of a directory (defaults to `Mix.Project.app_path()`). - **report_file** (string) - Optional - Name of the generated file (defaults to "test-junit-report.xml"). ### Returns - **String.t** - The full path to the report file. ``` -------------------------------- ### Define JUnitFormatter.Stats type Source: https://hexdocs.pm/junit_formatter/JUnitFormatter.Stats.html Represents the structure of the Stats object used for tracking test suite metrics. ```elixir @type t() :: %JUnitFormatter.Stats{ errors: non_neg_integer(), failures: non_neg_integer(), skipped: non_neg_integer(), test_cases: [ExUnit.Test.t()], tests: non_neg_integer(), time: non_neg_integer() } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.