Added mocha support to angular-mocks #1253

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
6 participants
Contributor

camwest commented Aug 10, 2012

Hey there,

Here is a simple pull request to add mocha support to angular-mocks. I'm not exactly sure the right way to test this as jasmine is always going to be present in the test suite.

If someone can point me in the right direction I'll implement the proper tests.

+1

Owner

mhevery commented Aug 31, 2012

Thanks for your contribution! In order for us to be able to accept it, we ask you to sign our CLA (contributor's license agreement).

CLA is important for us to be able to avoid legal troubles down the road.

For individuals (a simple click-through form):
http://code.google.com/legal/individual-cla-v1.0.html

For corporations (print, sign and scan+email, fax or mail):
http://code.google.com/legal/corporate-cla-v1.0.html

Contributor

camwest commented Aug 31, 2012

@mhevery I've signed the CLA.

Owner

mhevery commented Sep 4, 2012

MERGED

mhevery closed this Sep 4, 2012

Contributor

camwest commented Oct 17, 2012

It's true but that code is guarded on a condition which checks for
window.jasmine. isSpecRunning is redefined further down in the mocha
section.

On Wed, Oct 17, 2012 at 11:04 AM, Jack Chu notifications@github.com wrote:

I'm trying to use this feature, but I'm getting TypeError: Cannot read
property 'running' of undefined.

In angular-mocks.js:

function isSpecRunning() {
return currentSpec && currentSpec.queue.running;
}

I think queue.running is a jasmine only feature. So queue returns
undefined when using mocha.


Reply to this email directly or view it on GitHubhttps://github.com/angular/angular.js/pull/1253#issuecomment-9530583.

@camwest's angular-mocks.js seems to be different than the one in this repo. This one doesn't redefine isSpecRunning. The commits are different: 92558fe vs https://github.com/camwest/angular.js/commit/bbe0a9c862980a3eb5fa583d21efab06bb2f7ed0

Also, the Jasmine version of isSpecRunning should be using Jasmine's isRunning() function instead of using the value of running directly.

Contributor

camwest commented Oct 20, 2012

Weird. I thought it got merged in.

Cameron Westland

On Saturday, 20 October, 2012 at 10:28 AM, Tasveer Singh wrote:

@camwest (https://github.com/camwest)'s angular-mocks.js seems to be different than the one in this repo. This one doesn't redefine isSpecRunning. The commits are different: 92558fe (92558fe) vs camwest/angular.js@bbe0a9c (https://github.com/camwest/angular.js/commit/bbe0a9c862980a3eb5fa583d21efab06bb2f7ed0)
Also, the Jasmine version of isSpecRunning should be using Jasmine's isRunning() function instead of using the value of running directly.


Reply to this email directly or view it on GitHub (#1253 (comment)).

Yeah me too :)

Maybe @mhevery can take a look?

cjroebuck referenced this pull request Nov 18, 2012

Closed

Testing with mocha #1589

Contributor

metamatt commented Feb 15, 2013

As far as I can tell, #1467 is a real issue and is still correct, and is (as explained above) due to the difference between bbe0a9c (@camwest fork) and 92558fe (what actually got merged to master for 1.1.1).

It hasn't changed since 1.1.1, so it's still broken; I monkey-patched isSpecRunning() to look like 92558fe and that seems to work.

Is it better to use one of the existing issue reports to track this or open a new one?

@metamatt metamatt added a commit to metamatt/angular.js that referenced this pull request Feb 26, 2013

@metamatt metamatt fix(ngMock): fix isSpecRunning to work for Mocha
When running inside Mocha, don't look in Jasmine's spec.queue.running.
It's not there. This is documented as issue #1467; I think this issue was
also responsible for #1589 and recent complaints in #1253.

Closes #1467.
5a7fa26

@IgorMinar IgorMinar added a commit that referenced this pull request Feb 26, 2013

@metamatt @IgorMinar metamatt + IgorMinar fix(ngMock): fix isSpecRunning to work for Mocha
When running inside Mocha, don't look in Jasmine's spec.queue.running.
It's not there. This is documented as issue #1467; I think this issue was
also responsible for #1589 and recent complaints in #1253.

Closes #1467.
6397860

I don't think this is fixed in the 1.0.8 version of angular-mocks.js.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment