FSpec command line runner can't find my tests
Opened this issue · 4 comments
I am trying to run an example from the command line but spec runner does not find any tests.
My best guess from your description is that you need to assign the examples to a value named specs
let specs =
describe "My feture" [
it "works" ...
]
This is important for two reasons. The first is that the describe
function does not actually change any state. In returns a hierarchical structure containing the actual tests. So we need to store it somewhere.
Secondly, F# don't actually execute code in modules, until you actually access the module, so I needed some convention to be sure that the I could trigger the execution of the module code, and in this case, it is iterating through modules, and get the value specs
Casing is important! lowercase specs
Actually I just copied the code from one of the tests...
module MyModule =
let specs =
describe "Some component" [
describe "Some feature" [
context "In some context" [
it "has some specific behaviour" (fun _ ->
()
)
it "has some other specific behavior" (fun _ ->
()
)
]
context "In some other context" [
it "has some completely different behavior" (fun _ ->
()
)
]]]
What I have seen so far is that when selecting the types to run FSharpType.IsModule
fails.
Found it! It's a F# runtime issue.
FSpec has configure 4.3.0 and my project 4.3.1. That's why MyModule
does not get selected to be run.
I'll research a bit more to see how can be fixed.