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

expect is not a function #798

Closed
jcowgar opened this issue Dec 10, 2017 · 3 comments
Closed

expect is not a function #798

jcowgar opened this issue Dec 10, 2017 · 3 comments

Comments

@jcowgar
Copy link

jcowgar commented Dec 10, 2017

I've installed lab and cannot run the examples because expect is missing. Did I miss a step somewhere?

$ npm install --save-dev lab
$ cat > test/example.test.js
const { expect, it } = exports.lab = require('lab').script();

it('returns true when 1 + 1 equals 2', () => {

    expect(1 + 1).to.equal(2);
});
$ lab
Failed tests:

  1) returns true when 1 + 1 equals 2:

      expect is not a function

      at it (D:\Users\jerem\Projects\AMPS\dragon-js\test\example.test.js:5:5)
      at Immediate.setImmediate [as _onImmediate] (D:\Users\jerem\Projects\AMPS\dragon-js\node_modules\lab\lib\runner.js:566:31)
      at runCallback (timers.js:785:20)
      at tryOnImmediate (timers.js:747:5)
      at processImmediate [as _immediateCallback] (timers.js:718:5)


1 of 1 tests failed
Test duration: 3 ms
No global variable leaks detected
@cjihrig
Copy link
Contributor

cjihrig commented Dec 10, 2017

expect() comes from the code assertion library, not lab itself. There was a brief time recently when they were bundled together, but now you need to install and require('code') to get it.

@jcowgar
Copy link
Author

jcowgar commented Dec 11, 2017

Yes, that worked, closing. I'll create a different ticket, maybe a pull request, to fix the getting started docs.

@lock
Copy link

lock bot commented Jan 9, 2020

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants