karun012 / arion

MIT License
46 stars 7 forks source link

can't run spec modules? #8

Open mwotton opened 9 years ago

mwotton commented 9 years ago

Standard way of setting up HSpec test files, as far as i'm aware, is to create a hierarchy of test/Foo/BarSpec.hs, and export 'spec' from each, letting hspec-discover do the work of collecting them. Arion doesn't seem to support this workflow:

module Language.Pythia.InterpreterSpec where

spec = ...

gives

/home/mark/projects/meanpath/pythia/test/Language/Pythia/InterpreterSpec.hs:1:33:
    Not in scope: ‘main’
    Perhaps you meant ‘min’ (imported from Prelude)
karun012 commented 9 years ago

Arion uses runhaskell to run individual tests. Does the example that you have here export a main that calls spec? On Mar 29, 2015 8:18 PM, "Mark Wotton" notifications@github.com wrote:

Standard way of setting up HSpec test files, as far as i'm aware, is to create a hierarchy of test/Foo/BarSpec.hs, and export 'spec' from each, letting hspec-discover do the work of collecting them. Arion doesn't seem to support this workflow:

module Language.Pythia.InterpreterSpec where

spec = ...

gives

/home/mark/projects/meanpath/pythia/test/Language/Pythia/InterpreterSpec.hs:1:33: Not in scope: ‘main’ Perhaps you meant ‘min’ (imported from Prelude)

— Reply to this email directly or view it on GitHub https://github.com/karun012/arion/issues/8.

mwotton commented 9 years ago

No. hspec-discover usually constructs a file on the fly that finds all of the spec files.

http://hspec.github.io/hspec-discover.html is the workflow i'm talking about.

karun012 commented 9 years ago

Yup. That's how hspec discover works :). Arion expects a main in every spec so that it can run them individually. On Mar 29, 2015 8:25 PM, "Mark Wotton" notifications@github.com wrote:

No. hspec-discover usually constructs a file on the fly that finds all of the spec files.

http://hspec.github.io/hspec-discover.html is the workflow i'm talking about.

— Reply to this email directly or view it on GitHub https://github.com/karun012/arion/issues/8#issuecomment-87528849.

mwotton commented 9 years ago

so it's one or the other? hm. that's a pity. I still need a way to run all my tests in CI etc.

karun012 commented 9 years ago

Well. It works this way for now. But I can guarantee you that I have some improvements planned where I want to run the tests differently.

It's just one line of code you will have to add per spec :-)

main = hspec spec

hspec-discover will still work without any problem and so will Arion.

We can keep this issue open and tie it to a future milestone. Does that sound good :)?

On Mar 29, 2015 8:32 PM, "Mark Wotton" notifications@github.com wrote:

so it's one or the other? hm. that's a pity. I still need a way to run all my tests in CI etc.

— Reply to this email directly or view it on GitHub.

karun012 commented 9 years ago

I can guarantee you that hspec-discover will not break. All of Arion's specs have a main function. Once I had basic functionality I used Arion to watch and run specs while I was making it better.

mwotton commented 9 years ago

ah, good point - ok, I can live with that for now. It's certainly a lot faster than my

inotifywait -m -r .  -e CLOSE_WRITE |grep --line-buffered '\.hs$'   | grep -v --line-buffered flymake | ~/bin/collapse | while read x; do cabal test; done

hack

karun012 commented 9 years ago

Thanks. I will make sure I come up with a solution for this.

akurilin commented 9 years ago

I also have my tests set up to use hspec auto-discovery, see this as example: https://github.com/yesodweb/yesod-scaffold/tree/postgres/test

karun012 commented 9 years ago

You just need one line of code per spec for now :)

I'll get to this in the near future. Have some plans of running tests differently. On Mar 30, 2015 12:50 PM, "Alexandr Kurilin" notifications@github.com wrote:

I also have my tests set up to use hspec auto-discovery, see this as example: https://github.com/yesodweb/yesod-scaffold/tree/postgres/test

— Reply to this email directly or view it on GitHub https://github.com/karun012/arion/issues/8#issuecomment-87805657.