-
Notifications
You must be signed in to change notification settings - Fork 47
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 seq/par and hook #83
Conversation
the reason is that using generic instance results in: ``` /dev/purescript-spec/output/Data.Generic.Rep.Show/index.js:13 var GenericShowArgs = function (genericShowArgs) { ^ RangeError: Maximum call stack size exceeded at new GenericShowArgs (/dev/purescript-spec/output/Data.Generic.Rep.Show/index.js:13:32) at Object.genericShowArgsArgument (/dev/purescript-spec/output/Data.Generic.Rep.Show/index.js:20:12) at showGroup (/dev/purescript-spec/output/Test.Spec/index.js:241:228) at showGroup (/dev/purescript-spec/output/Test.Spec/index.js:241:456) ```
This is ready for review @felixmulder @owickstrom. tomorrow will try to fix issue with reporter (about parallel nested describes) and add some docs. let me know if there are some comments/suggestions. |
Cool! Won't have time to review today - but hopefully during the weekend 🙂 |
as they are not Aff specific any more
now consoleReporter and specReporter need to coordinate tests which are running in parallel
The issue I have now is that describe "a" $ parallel do
it "a.1" $ delay $ Milliseconds 500.0
it "a.2" $ delay $ Milliseconds 500.0
describe "b" do
it "b.1" $ delay $ Milliseconds 500.0
it "b.2" $ delay $ Milliseconds 500.0 so a reporter will get events in this order, which is messing output:
solution is to make reporters more "advanced", by showing currently running tests with some spinner, and then once they finish update corresponding indicators, ideally so that if a test is logging something to console, it's not interfering to the test output (I haven't done such things in terminal and some suggestions/helpful links, would be great help for fixing this issue) |
AFAICT without some kind of mocking/monkey patching, a reporter has no way to know if a running test logged something to terminal. If that's true, we have 2 options:
I would at first go with option 1 and then probably in new PR implement option 2 so, before that using console.log in |
so i was able to update spec/console reporters to handle parallel execution: But, :(if a line printed to console is wrapped, then redraw is messed up and output looks like this: this particular issue can be fixed in so at this point I feel that the "redrawing" terminal output is not a good idea, so will try to simplify reporters and will log things to console which are not going to change, it would mean that if you are running multiple tests in parallel you wouldn't see there output until whole all of them are finished. |
Wow, awesome work @safareli ! You've really put time into this. |
Quite a large PR - but I couldn't see anything that raised a red flag with me. @owickstrom, maybe you'd like to review as well? |
Yeah, was working on it for about a week, we are using this lib at @f-o-a-m, and we wanted to have this features, so it was sort of my "task". |
with `exit: false` and you can get test results with `[]` as reporters you can get no reporting so removed runSpec,runSpec' and renamed run,run' to runSpec and runSpecM
for example here all types are derived by compiler: ``` foo :: forall t19. Monad t19 => SpecT Aff Unit t19 Unit foo = it "foo" $ delay $ Milliseconds 100.0 baz :: forall t17 t18 t19. Monad t19 => SpecT t18 t17 t19 Unit baz = describe "baz" $ pure unit fix :: forall t18 t19. Monad t19 => MonadThrow Error t18 => SpecT t18 Unit t19 Unit fix = it "fiz" $ 1 `shouldEqual` 1 ``` vs beofre you would get huge `WriterT ...` type.
It would be great if someone could check changes made in documentation. |
I'll have a look when I'm back from vacation. Thanks for your effort on this @safareli! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A lot of cool stuff going on, I hope I didn't miss anything. Mostly my comment about compatibility that I would stress, and perhaps the test.
Otherwise, really awesome work! 🎉
|
||
-- | Run the spec with the default config | ||
run | ||
runSpec |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think runSpec
is a better name, but can we for compatibility reasons also have run
? As an alias of runSpec
, perhaps with a deprecation Warn
constraint?
test/Test/Spec/RunnerSpec.purs
Outdated
it "supports async" do | ||
res <- delay (Milliseconds 10.0) *> pure 1 | ||
res `shouldEqual` 1 | ||
where | ||
runSpecFocused t = discardUnfocused (execWriter $ un SpecT t) <#> bimap (const unit) (un Item >>> _.isFocused) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
runSpecFocused
, if I'm not misunderstanding, isn't running the full runSpec
machinery, like this test did before. It seems it's collecting a tree structure of Maybe Bool
values for isFocused
. Would it be possible to rewrite this to use runSpec (or some underlying function) to exercise the runner module?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most I could do is to add collect
let me know if there is something you think is worth adding/changing.
Besides what was commented as part of the review I have change type of |
After we merge this we should probably update ps-spec-* libs
Let me know what others think about this. |
Also do you think it's worth releasing this changes as |
🏓 ping |
I'm good with these last changes! And yeah, I think releasing an RC would be good. |
@felixmulder you good with merging this? |
👏 |
Made a release v4.0.0-rc1 |
fix #80
fix #43
fix #44 (any m can be lifted into Spec so you can lift Effect too)
fix #63
fix #68 (in the end user can hoist Either to Aff)
it might somewhat fixes #73 haven't looked into it yet
Initially I tired to rebase #52 on top of #82 but using the approach taken in #52 it was not possible to define
afterAll
and nesting of hooks was not possible too. So instead I ported this version from hspec.things left to do: