Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion mocha doesn't run tests with dev2.1
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Bill Magnuson  
View profile  
 More options Oct 3 2012, 1:35 am
From: Bill Magnuson <b...@billmagnuson.com>
Date: Tue, 2 Oct 2012 22:35:02 -0700 (PDT)
Local: Wed, Oct 3 2012 1:35 am
Subject: Re: [requirejs] mocha doesn't run tests with dev2.1

My understanding of the yeoman thread and the mocha docs are that once you
call mocha's describe() and it() functions that it'll automatically wait
for the done() function call to execute when your code invokes something
asynchronously. However, if the describe() and it() functions don't get
called synchronously (which they won't if they're in the require callback)
that the async support won't work.

On Tuesday, October 2, 2012 5:44:17 PM UTC-4, James Burke wrote:

> On twitter, @InderjitGill pointed to this thread that may be helpful:

> https://groups.google.com/forum/?fromgroups=#!topic/yeoman-dev/5TLE8A...

> I have not used mocha though so I do not quite follow it.

> On Tue, Oct 2, 2012 at 12:06 PM, Erwin Poeze <erwin...@gmail.com<javascript:>>
> wrote:
> > I'm trying to figure out if mocha as some sort of stop/start
> functionality,
> > like qunit has for example. I ran into an old request for a deferred
> > execution (https://github.com/visionmedia/mocha/issues/362).

> > The browser version of moncha does seem to have such an option,
> mocha.run(),
> > but I can get the browser version running in node.

> > On Tuesday, October 2, 2012 7:41:35 PM UTC+2, James Burke wrote:

> >> Does Mocha have a "start" method? Maybe tell it not to autostart, and
> >> only start inside the require callback? QUnit has something like that.

> >> The "require always async" is to get more consistent behavior, so
> >> making that call synchronous is not suggested. I would like to sort
> >> out a solution that does not require it to be synchronous, as it may
> >> lead to subtle bugs, particularly after a build (the kind of bug that
> >> triggered this change in 2.1).

> >> You can force sync by overriding requirejs.nextTick to just call the
> >> fn passed to it. But this is not recommended, let's try to sort out
> >> how to use Mocha correctly for these async cases.

> >> James

> >> On Mon, Oct 1, 2012 at 11:02 PM, Erwin Poeze <erwin...@gmail.com>
> wrote:
> >> > Ok, I see. Mocha doesn't seem to have a 'wait' state. Can't the top
> >> > level
> >> > requirejs by set to sync?

> >> > On Monday, October 1, 2012 11:07:48 PM UTC+2, James Burke wrote:

> >> >> My guess is that now requirejs([], function (){}) calls always call
> >> >> the callback asynchronously. Is there a "wait" state you can put
> mocha
> >> >> in before doing the requirejs([]) call, and then resume it once the
> >> >> callback is called?

> >> >> James

> >> >> On Mon, Oct 1, 2012 at 2:51 AM, Erwin Poeze <erwin...@gmail.com>
> wrote:
> >> >> > Hi,

> >> >> > I tried to use dev2.1 because it seems it has a bug is solved that
> I
> >> >> > encountered too. When I run existing test cases with mocha using
> the
> >> >> > dev2.1
> >> >> > r.js, mocha seems to skip all the test (0 tests completed). When a
> >> >> > rebase
> >> >> > r.js to master and create the r.js again, the mocha tests run ok.

> >> >> > The most simple testcase I could create is (not testing anything,
> >> >> > just
> >> >> > echoing to console):

> >> >> > var requirejs = require('../r.js');
> >> >> > //var requirejs = require('requirejs');

> >> >> > requirejs.config({
> >> >> >   baseUrl: __dirname+'/..',
> >> >> >   nodeRequire: require
> >> >> > });

> >> >> > requirejs([
> >> >> >   'lib/schemas/Layout'
> >> >> > ],
> >> >> > function(
> >> >> >   LayoutSchema
> >> >> > ) {
> >> >> >   describe('Test', function() {
> >> >> >     describe('should show', function() {
> >> >> >       it('something', function(done) {
> >> >> >         console.log('layout')
> >> >> >         done();
> >> >> >       });
> >> >> >     });
> >> >> >   });
> >> >> > });

> >> >> > Does anyone have similar experiences?

> >> >> > Thanks.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.