ciscoheat / buddy

Your friendly BDD testing library for Haxe!
MIT License
96 stars 24 forks source link

done timeoutMs does not seem to be working correctly #87

Closed remiX- closed 4 years ago

remiX- commented 4 years ago

Hi :)

I'm trying to debug an issue with using done but not actually calling it - so the timeout error will occur.

Using your failing example from Async Support, it doesn't seem to fail anymore even though timeoutMs is being changed to a much lower period. Keeping it as 100 but having the .delay be 6 seconds, it waits for the full 6s before passing - it doesn't fail.

I'm on Haxe version 4.1.4 This seems to occur on buddy 2.10.3 as well.

image

It also appears there's an issue with specifying done callback but not actually calling it. It only runs the tests before that part and nothing afterwards.

image

Hopefully I've given enough info :) Please ask if anything more is needed

Thanks for all the great work!

~Nick

ciscoheat commented 4 years ago

Hello! I used timeoutMs just a few days ago and then it worked fine. What you can try right now is to put the timeoutMs assignment outside any describe or it, but that shouldn't be a problem so I'll have to take a closer look in a while. I'll keep you posted.

remiX- commented 4 years ago

Hey! Thanks for the fast reply!

Hmm weird that it worked for you. I used a fresh folder and install of buddy and this is what I got :(

Yeah I've also used it in the past and worked completely fine, but that was around last year.

Don't think I've broken anything myside in that folder

Edit: tried moving the timeoutMs assignment outside and it seems to be same result for both cases

ciscoheat commented 4 years ago

Now I'm in front of a computer and I can see your screenshots clearly. :) A side note in the docs: "timeouts and asynchronous behavior aren't supported when targeting PHP or interp." and since you're using -x to test, it doesn't work since that uses interp.

remiX- commented 4 years ago

Ah yes that makes sense lol. I usually build to js and test with that but it wasn't working so reverted to interp :/

I get this error if building to js with this Suite, might you have any idea?:

using buddy.Should;

class BuddyMain extends buddy.SingleSuite {
    public function new() {
        describe("Using Buddy", {
            timeoutMs = 2000;

            describe("tests", () -> {
                it("Should build a thing", (done) -> {
                    1.should.be(0);
                });

                it("Should build a thing", () -> {
                    "hello".should.be("olleh");
                });
            });
        });
    }
}

Build: haxe -m BuddyMain.hx -lib buddy -js out.js

Error:

image

kLabz commented 4 years ago

For nodejs install hxnodejs haxelib and do haxe -m BuddyMain.hx -lib buddy -js out.js -lib hxnodejs

(previously we could just do -D nodejs but now there is a dependency to nodejs externs)

remiX- commented 4 years ago

Aaah ok awesome, at least I know now.

Thanks for all the help, seems I was just being silly :P