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

Remove testing dependencies from library dependencies #53

Open
agrafix opened this issue Aug 12, 2016 · 4 comments
Open

Remove testing dependencies from library dependencies #53

agrafix opened this issue Aug 12, 2016 · 4 comments

Comments

@agrafix
Copy link

agrafix commented Aug 12, 2016

Currently when installing servant-swagger it also pulls in QuickCheck and hspec. Are there any plans to remove this, or make it configurable via a flag?

@fizruk
Copy link
Member

fizruk commented Aug 12, 2016

Servant.Swagger.Test is an experimental but very useful module. It does drag some heavy dependencies like QuickCheck and hspec with it, but since it is just one module with virtually one function we have decided to leave it in servant-swagger. Also I guess most (some?) servant-swagger users use QuickCheck and hspec anyway.

A better alternative would be to create a separate servant-swagger-hspec package or something like that. The main reason we didn't split a separate package was because no one complained :)
Another reason was that I wanted to find a perfect solution and first move type-level stuff needed for tests to servant as its very general and might be useful for other means (e.g. servant-docs uses similar type families). See haskell-servant/servant#345 for more details and discussion.

For now we could add a Cabal flag if these extra dependencies are uncomfortable for you.

@agrafix
Copy link
Author

agrafix commented Aug 12, 2016

Wow Servant.Swagger.Test is cool! In general I use both hspec and HTF, but current project is using HTF. It would be cool to make Servant.Swagger.Test testing-framework independent, maybe one could abstract over the "property to unit test"-function? For HTF it would be qcAssertion :: QCAssertion t => t -> Assertion (from http://hackage.haskell.org/package/HTF-0.13.1.0/docs/Test-Framework-QuickCheckWrapper.html), for hspec it's prop :: (?loc :: CallStack, Testable prop) => String -> prop -> Spec. So essentially validateEveryToJSON would need a type signature like:

validateEveryToJSON
:: (_, QCAssertion p)
=> proxy api
-> (p -> spec)
-> spec

I have not tried it out, but this should work?

Apart from that a Cabal flag would be great for short term, I like to keep my dependencies clear of another testing framework as it adds build complexity and things that can go wrong.

@fizruk
Copy link
Member

fizruk commented Aug 12, 2016

I am not sure we'll be able to create a universal validateEveryToJSON.

Actually there's just once piece of code that is hspec-specific: props function which is used directly in validateEveryToJSON. props implementation depends only on hspec and QuickCheck (and some type-level functions defined, but not specific to servant-swagger).

I think rather than making an all-fit solution we should move this function to hspec and write a similar one for every other testing framework.

@akhesaCaro
Copy link
Contributor

Hi,
Servant-swagger will be moved into the main Servant repo (see : haskell-servant/servant#1475)
If this issue is still relevant, would it be possible for you to summit it there? : https://github.com/haskell-servant/servant/issues

Thanks in advance!

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