Use these functions and types to create the program that will run the spec suite.
See the README for a full example of how to use these functions to set up a spec suite.
The spec suite runner must provide a Config, which must be implemented as follows:
Create two ports:
port elmSpecOut : Message -> Cmd msg
port elmSpecIn : (Message -> msg) -> Sub msgAnd then create a Config like so:
config : Spec.Runner.Config msg
config =
{ send = elmSpecOut
, outlet = elmSpecOut
, listen = elmSpecIn
}The send and outlet attributes must reference the same port, elmSpecOut.
Create a spec suite program for describing the behavior of browser-based programs.
Once you've created the Config value, I suggest adding a function like so:
program : List (Spec model msg) -> Program Flags (Model model msg) (Msg msg)
program =
Spec.Runner.browserProgram configThen, each of your spec modules can implement their own main function:
main =
Runner.program
[ ... some specs ...
]The JavaScript runner will find each spec module and run it as its own program.
Create a spec suite program for describing the behavior of headless programs.
Once you've created the Config value, I suggest adding a function like so:
program : List (Spec model msg) -> Program Flags (Model model msg) (Msg msg)
program =
Spec.Runner.program configThen, each of your spec modules can implement their own main function:
main =
Runner.program
[ ... some specs ...
]The JavaScript runner will find each spec module and run it as its own program.
Represents a message to pass between elm-spec and the JavaScript elm-spec runner.
Flags that the JavaScript runner will pass to the spec suite program.
Used by the spec suite program.
Used by the spec suite program.
Pick this scenario to be executed when the spec suite runs.
When one or more scenarios are picked, only picked scenarios will be executed, regardless of whether tags are specified via the spec runner.
Note that the first argument to this function must be a port defined like so:
I suggest adding a function to the main Runner file in your spec suite, where you've defined your
Configand so on:Then, to pick a scenario to run, do something like this: