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

Test reporter hangs on async tests #1

Closed
fhartwig opened this issue Oct 7, 2015 · 7 comments
Closed

Test reporter hangs on async tests #1

fhartwig opened this issue Oct 7, 2015 · 7 comments

Comments

@fhartwig
Copy link

fhartwig commented Oct 7, 2015

When I use the mocha test reporter to run a test like the following

main = run [mochaReporter] do
    describe "do something" do
        it "successfully does something" do
            liftEff $ log "hello"
            res <- later' 100 $ return "Alligator"
            liftEff $ log "good bye"
            return unit

, the test page just hangs showing passes: 0 failures: 0 duration: 0s. If I comment out the line containing later', everything works and the test success is shown. In either case the second log message is shown in the console.

(I apologise if this is expected behaviour / a user error. I'm new to purescript and js programming in general.)

@owickstrom
Copy link
Collaborator

Thanks for reporting! I'll look into this as soon as possible. :)

@owickstrom
Copy link
Collaborator

OK, I know what's the issue here and it's the implementation of the Mocha reporter together with how reporters work in purescript-spec. Working on it now. :)

@fisx
Copy link

fisx commented Nov 14, 2015

any news on this? i may have time to contribute code to this, and changes will improve if you can fill us in on what you already know. thanks! (-:

@owickstrom
Copy link
Collaborator

Oh, sorry for dropping the ball on this one. Have been short on time lately, but I got somewhere with this on the async-reporter branch: https://github.com/owickstrom/purescript-spec/tree/async-reporter

It does not compile but I think it's nearly there. The idea is to change from having a fully collected test result tree which the reporters can use, to let reporters await tests themselves.

-- Previously:
type Reporter e = Array Group -> Eff e Unit
-- Now:
type Reporter e = Array (Group (Aff e Unit)) -> Aff e Unit

This way the mocha reporter can call the underlying it, describe etc synchronously and run the done callback asynchronously.

If you have the time to look at this and perhaps finish the stuff that I started that would be very helpful! :) I'd love to get some more people involved in this project.

By the way, this could be affected by purescript-spec/purescript-spec#16, the suggestion for a Free monad implementation of purescript-spec to support selective runs of test (skip, only).

@fisx
Copy link

fisx commented Nov 15, 2015

ok, thanks! i should be able to work with that. now it's my turn to drop the ball. but i'll try not to! give me a week or two- (-:

@owickstrom
Copy link
Collaborator

No problem at all, I guess it's you folks that need this the most right now, and I'm just utterly grateful for all the help I can get. 👍

@owickstrom
Copy link
Collaborator

A year later, and now this works. I got some energy for my PureScript projects and decided to fix this limitation. Use purescript-spec 0.10.0 and purescript-spec-mocha 0.2.0 (notice the name change).

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