2

In the document of http://zombie.js.org/, there is an example:

browser.visit('/path', function() {
  assert(browser.location.href == 'http://example.com/path');
});

It does the assertion in the callback of browser.visit, is it the correct way?

When I use mocha to run such a test, I found it always success, even if the assertion is failed.

I searched the keyword browser.visit in the codebase of zombie, didn't find similar usage, instead, it does the assertion out of the visit, like:

before(function(done) {
    browser.visit('/path', function() { done(); });
});

it("should do something", function() {
   assert(browser.location.href == 'http://example.com/path');
});

I'm not sure which is the correct way.

Freewind
  • 193,756
  • 157
  • 432
  • 708

0 Answers0