Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't run spec modules? #8

Open
mwotton opened this issue Mar 30, 2015 · 10 comments
Open

can't run spec modules? #8

mwotton opened this issue Mar 30, 2015 · 10 comments

Comments

@mwotton
Copy link
Collaborator

mwotton commented Mar 30, 2015

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
Copy link
Owner

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
#8.

@mwotton
Copy link
Collaborator Author

mwotton commented Mar 30, 2015

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
Copy link
Owner

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
#8 (comment).

@mwotton
Copy link
Collaborator Author

mwotton commented Mar 30, 2015

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
Copy link
Owner

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
Copy link
Owner

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
Copy link
Collaborator Author

mwotton commented Mar 30, 2015

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
Copy link
Owner

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

@AKurilin
Copy link

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
Copy link
Owner

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
#8 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants