View Source Igniter.Test (igniter v0.4.7)
Tools for testing with igniter.
Summary
Functions
Fakes applying the changes of an igniter.
Applies an igniter, raising an error if there are any issues.
Return the current igniter
diff.
Print the current igniter
diff, returning the igniter
.
Sets up a test igniter that has only the files passed to it.
Functions
@spec apply_igniter(Igniter.t()) :: {:ok, Igniter.t(), %{ tasks: [{String.t(), [String.t()]}], warnings: [String.t()], notices: [String.t()] }} | {:error, [String.t()]}
Fakes applying the changes of an igniter.
This function returns any tasks, errors, warnings.
Applies an igniter, raising an error if there are any issues.
See apply_igniter/1
for more.
Return the current igniter
diff.
Options
:only
- Only return the diff for this file or files
Print the current igniter
diff, returning the igniter
.
This is primarily used for debugging purposes.
Options
:label
- A label to print before the diff:only
- Only print the diff for this file or files
Sets up a test igniter that has only the files passed to it.
Starting point
All of the files of an empty mix project are added by default.
You can specify more or overwrite files with the :files
option.
Limitations
You cannot install new dependencies, or use dependencies your own project does not have.
If you need to do that kind of thing, you will have to do a test that uses tools like
System.cmd
in a temporary directory.
Options
files
- A map of file paths to file contents. The file paths should be relative to the project root.app_name
- The name of the application. Defaults to:test
.
Examples
test_project(files: %{
"lib/foo.ex" => """
defmodule MyApp.Foo do
use Ash.Resource
end
"""
})