Message from discussion
mocha doesn't run tests with dev2.1
Received: by 10.50.216.193 with SMTP id os1mr6357094igc.4.1349199695450;
Tue, 02 Oct 2012 10:41:35 -0700 (PDT)
X-BeenThere: requirejs@googlegroups.com
Received: by 10.42.249.136 with SMTP id mk8ls1656794icb.9.gmail; Tue, 02 Oct
2012 10:41:34 -0700 (PDT)
Received: by 10.50.36.199 with SMTP id s7mr6358991igj.3.1349199694248;
Tue, 02 Oct 2012 10:41:34 -0700 (PDT)
Received: by 10.50.36.199 with SMTP id s7mr6358990igj.3.1349199694237;
Tue, 02 Oct 2012 10:41:34 -0700 (PDT)
Return-Path: <jrbu...@gmail.com>
Received: from mail-ob0-f174.google.com (mail-ob0-f174.google.com [209.85.214.174])
by gmr-mx.google.com with ESMTPS id s15si85421igi.1.2012.10.02.10.41.34
(version=TLSv1/SSLv3 cipher=OTHER);
Tue, 02 Oct 2012 10:41:34 -0700 (PDT)
Received-SPF: pass (google.com: domain of jrbu...@gmail.com designates 209.85.214.174 as permitted sender) client-ip=209.85.214.174;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of jrbu...@gmail.com designates 209.85.214.174 as permitted sender) smtp.mail=jrbu...@gmail.com; dkim=pass header...@gmail.com
Received: by mail-ob0-f174.google.com with SMTP id uo13so7377668obb.33
for <requirejs@googlegroups.com>; Tue, 02 Oct 2012 10:41:34 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20120113;
h=mime-version:in-reply-to:references:date:message-id:subject:from:to
:content-type;
bh=giTKhlsSxWCNge7CGLE1YTu8zayligUupM22l+bHObw=;
b=KDN2DOegYNVWdshZbLPSkwmCEVH3LtaB1mkM07tsy7pR2NezxsISigcjtN4pgpi7SM
/9d1FmbBh7jAhr62LgoM6tJHC+GnrtYBoE6/ZJ2ShVzAzhbOsUhaP3/UlJ9MWeM0A0Xd
byr50D3GnZ8I2HIiLc9rd5qeM1wRKgf30hO9yiLBvOkaPV99L9hyazExrn0HKoQsLsiK
R7JXOR6+1MwQ928sun6sAAkibzmV+DpdOF6Ewp9LAoefmTDc49VYBGEYICyT/0kJpZdo
peODsOrAqgYuACCYjlCLUiwzq4wYBxKNRPhpxJu62Rmh5FwUYBQPnOqKuUaYXwF0GGdI
bv7g==
MIME-Version: 1.0
Received: by 10.60.31.170 with SMTP id b10mr14674542oei.107.1349199694064;
Tue, 02 Oct 2012 10:41:34 -0700 (PDT)
Received: by 10.60.10.130 with HTTP; Tue, 2 Oct 2012 10:41:34 -0700 (PDT)
In-Reply-To: <71ba793f-6b88-4868-8e72-3199ba4340eb@googlegroups.com>
References: <84f47213-f5df-4037-8e50-1826468d8712@googlegroups.com>
<CAHgY_if6STdBY+VOFJw-by4v6jz-q8N2Ucguch6TsLOap7p...@mail.gmail.com>
<71ba793f-6b88-4868-8e72-3199ba4340eb@googlegroups.com>
Date: Tue, 2 Oct 2012 10:41:34 -0700
Message-ID: <CAHgY_id8eqeYHoZUANDPWiXnrKeSALKNOkZKvp=TFznBfCg...@mail.gmail.com>
Subject: Re: [requirejs] mocha doesn't run tests with dev2.1
From: James Burke <jrbu...@gmail.com>
To: requirejs@googlegroups.com
Content-Type: text/plain; charset=ISO-8859-1
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.po...@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.