-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add Test.Hspec.JUnit.Formatter #28
Conversation
This isn't totally done, but here is a little bit of an experience report so far: The good
The bad
|
🎉
Did you read https://hspec.github.io/hspec-discover.html#spec-hooks?
This is for historic reason. Originally there was only
Yes.
No.
No.
You shouldn't use CPP. The whole point of versioning the APIs is to not require users of the API to use CPP.
I agree that for this specific situation, non- If we would start from a clean slate, we could go with non-
It will work, except for the limitation you pointed out at hspec/hspec#895 (comment) (if a user selects a different format with |
Thanks for the details. All makes sense.
Read it now and I think I understand. It might be useful to document what order loaded hooks are run in when there are multiple, since that can be important.
That makes sense. I probably got confused because I started this whole journey with a PR in hspec itself, and so was exposed first to
Agreed and agreed.
I think I do, but I'm not sure if the reason is sound. We try to support older GHCs for as far back as is reasonable without too much fuss. And, pragmatically, we test this on CI by using (and supporting) older Stackage LTSs. So, while I don't have an explicit reason to target older hspecs, it can be necessary in order to run in an older LTS overall, as sometimes pulling in one latest extra-dep on top of a very old resolver can get you into a spiral of transitive issues. I guess my question would be, if I remove my CPP and just target |
Oh, that's actually worse than the limitation I was describing there. I was hoping that |
Not really, |
Yes, otherwise formatters added with |
This PR adds an implementation of our formatter via the newer "hooks" feature of Hspec, as documented here and here.
There are other general cleanups in this PR, but the import parts are:
Test.Hspec.JUnit.Format
: this is a copy/pasted version ofjunitFormat
but targeting theFormat.V1
types, notCore.Format
. I chose to copy (instead of refactor) because I've deprecated, and plan to remove soon,junitFormat
Test.Hspec.JUnit.Formatter
: this packages things up into hooks; all these functions take an explicitJUnitConfig
argumentTest.Hspec.JUnit.Formatter.Env
: same as above, but readingJUNIT_*
environment variables instead of accepting that argument