busterjs / buster

Abandoned - A powerful suite of automated test tools for JavaScript.
http://docs.busterjs.org
Other
448 stars 37 forks source link

"expect is not defined" #381

Closed mroderick closed 10 years ago

mroderick commented 10 years ago

In 0.7.x, expect is not defined as a global, even after buster.spec.expose()

See https://github.com/mroderick/buster-spec-bug for details

olance commented 10 years ago

I had this error too, but found the following in the release notes:

assert, refute and other globals or gone. Buster only exposes the buster global now.

It then goes on explaining how to specify helpers to get expect back as an available global helper.

However I found that your helper file should most likely look like this for that workaround to work (for node testing):

var buster = require('buster');

assert = buster.assert;
refute = buster.refute;
expect = buster.expect;
dwittner commented 10 years ago

It isn't intended to expose the expect function, only the functions describe, it, itEventually, before, beforeAll, beforeEach, after, afterAll and afterEach. You have to make the function available via var expect = buster.expect;.