vizicities icon indicating copy to clipboard operation
vizicities copied to clipboard

Unit tests don't pass every time (v0.2.0)

Open brianchirls opened this issue 9 years ago • 4 comments

Sometimes it doesn't pass the first time you run it. Usually passes the second time. Never the same error twice. Sometimes properties missing, sometimes other random tests. It doesn't make a whole lot of sense.

Maybe something's loading asynchronously and you're making assumptions about things being ready when they're not?

brianchirls avatar Dec 13 '14 01:12 brianchirls

Actually, now that I look a little closer at it, the tests that are failing are ones that are running twice. They pass the first time and fail the second. I don't know enough about mocha or chai to guess why that might happen.

brianchirls avatar Dec 13 '14 01:12 brianchirls

This has been a pain for a while now and I'm desperate to get it fixed. It's interesting you say that it's only happening on tests that run twice. I wonder why they would be running twice.

How did you discover the tests were running twice? I should be able to dig into it from there. Otherwise, I think if I can find a way to make the tests synchronous then things will be ok.

robhawkes avatar Dec 16 '14 11:12 robhawkes

I just happened to notice that the same text was being output multiple times. Here's one I just ran...

VIZI.BlueprintHelperTileGrid ✓ exists in VIZI namespace ✓ throws error when missing world argument ✓ has an options property ✓ has a disable property ✓ has a centerTile property that contains a VIZI.Point instance ✓ has a centerTileLatLon property that contains a VIZI.LatLon instance ✓ has a tileZoom property ✓ has a cullZoom property ✓ has a tilesPerDirection property ✓ has an undefined bounds property 1) has an undefined bounds property 2) has an undefined bounds property 3) has an undefined bounds property ✓ has an undefined boundsLatLon proper

On Tue, Dec 16, 2014 at 6:06 AM, Robin Hawkes [email protected] wrote:

This has been a pain for a while now and I'm desperate to get it fixed. It's interesting you say that it's only happening on tests that run twice. I wonder why they would be running twice.

How did you discover the tests were running twice? I should be able to dig into it from there. Otherwise, I think if I can find a way to make the tests synchronous then things will be ok.

— Reply to this email directly or view it on GitHub https://github.com/vizicities/vizicities/issues/119#issuecomment-67143795 .

brianchirls avatar Dec 16 '14 13:12 brianchirls

I'd like to start looking at this again soon, now that the new Blueprint API is taking shape. I remember seeing somewhere that the Mocha tests can be run asynchronously and that there's a way to run them synchronously in sequence rather than all at once (which may help here). I'll try and find out what project I saw that in though it seems like there's some other documentation on the matter.

robhawkes avatar Feb 24 '15 14:02 robhawkes