-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
before hook with promises: TypeError: Cannot read property 'call' of undefined #3080
Comments
fixed with before(async () => {
await delay('lol', 1000);
}); |
Can also be fixed with: before(function() {
return delay(...)
}) or before(delay.bind(null, ...)) (We could really use better error messages in the event that objects such as promises are given where Mocha expects callback functions. I thought we have an existing issue about that, but I haven't found it in a search so far...) |
I'm still getting this error: describe('sign up as a user when an account for that user already exists', () => {
before(async () => {
await createTestUser();
});
it.only('should not let me signup as a user if an account with that email exists.', done => {
const { email, authKey } = user;
chai.request(app)
.post('/auth/user/signup')
.type('application/json')
.send({ email, authKey})
.end(function(err, res) {
expect(res).to.have.status(200);
assert.deepEqual(res.body, {
message: 'That username already exists.',
});
done();
});
});
after(async () => {
await deleteTestUserByEmail(user.email)
});
}); Error 1) Auth Routes Tests
/auth/signup route
sign up as a user when an account for that user already exists
"before all" hook:
Uncaught TypeError: Cannot read property 'email' of null
at /Users/aaa/git/webapp_ps/tests/routes/authRoutes.test.js:9:3126
at /Users/aaa/git/webapp_ps/node_modules/mongoose/lib/model.js:4791:16
at /Users/aaa/git/webapp_ps/node_modules/mongoose/lib/query.js:4389:12
at model.Query.Query._completeOne (node_modules/mongoose/lib/query.js:2073:12)
at Immediate.<anonymous> (node_modules/mongoose/lib/query.js:2135:10)
at Immediate.<anonymous> (node_modules/mquery/lib/utils.js:116:16)
at processImmediate (internal/timers.js:456:21) Assume Any ideas? |
Why do you post this here? it's a totally different error
|
When running
mocha test
The output is:
mocha version: 4.0.1
possibly related to #2706, #2315
The text was updated successfully, but these errors were encountered: