Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.

Throw err when beforeEach.withApp is not called #37

Merged
merged 1 commit into from
Jan 13, 2015

Conversation

faridnsh
Copy link
Contributor

The error that is thrown when lt.beforeEach.withApp is called is cryptic and new users of this module, may not understand what's going on.

@slnode
Copy link

slnode commented Dec 31, 2014

Can one of the admins verify this patch? To accept patch and trigger a build add comment ".ok\W+to\W+test."

@bajtos
Copy link
Contributor

bajtos commented Jan 13, 2015

@slnode ok to test

@@ -225,6 +225,10 @@ _describe.whenCalledRemotely = function(verb, url, data, cb) {
urlStr = '/<dynamic>';
}

if (this.request === undefined) {
throw new Error('App is not specified. Please use lt.beforeEach.withApp to specify the app.');
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In your code, this points to _describe. However, the request variable is set on the beforeEach context provided by Mocha.

You need to move this check into beforeEach few lines below.

@bajtos
Copy link
Contributor

bajtos commented Jan 13, 2015

Also make sure that npm test passes. At the moment, it fails because of the problem pointed out in my comment above:

Error: App is not specified. Please use lt.beforeEach.withApp to specify the app.
    at Object._describe.whenCalledRemotely (/mnt/jenkins/workspace/loopback-testing.pr/a88e4f2b/lib/helpers.js:6:13080)
    at /mnt/jenkins/workspace/loopback-testing.pr/a88e4f2b/test/test.js:69:24

@faridnsh
Copy link
Contributor Author

Damn, I can't believe I never wrote test for this. I guess I missed it in the rush... I'll add a test for this and fix the problem with it.

@faridnsh
Copy link
Contributor Author

Actually I just realized it's not possible to test this cleanly(maybe that's why I didn't write it initially). I force pushed the fixed version. npm test works fine now.

@bajtos
Copy link
Contributor

bajtos commented Jan 13, 2015

Actually I just realized it's not possible to test this cleanly(maybe that's why I didn't write it initially).

Yeah, I have realised the same, that's why I didn't asked you to write a test :)

I force pushed the fixed version. npm test works fine now.

Thanks.

bajtos added a commit that referenced this pull request Jan 13, 2015
Throw err when beforeEach.withApp is not called
@bajtos bajtos merged commit 4948072 into strongloop-archive:master Jan 13, 2015
@bajtos
Copy link
Contributor

bajtos commented Jan 13, 2015

Landed and released as [email protected], thank you for the contribution!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants