尝试在mocha-phantomjs中运行异步测试时出现脚本错误(:0)

时间:2014-11-12 08:15:33

标签: asynchronous requirejs phantomjs mocha mocha-phantomjs

我正在尝试测试一段异步代码但遗憾的是我得到了一个模糊的错误代码,我似乎无法弄清楚问题是什么。测试在浏览器中运行良好,但在phantomjs中运行会导致:

Uncaught Script error. (:0)

测试编写为requirejs模块,并且依赖于另一个模块。 就像我说的,这在浏览器中运行良好,并且当没有做异步测试时一切正常 在phantomjs也很好。我正在使用phantomjs 1.9.12和mocha-phantomjs 3.4.1。

define([ "csl" ], function( csl ) 
{  
   describe( "CSL", function()
   {
      it( "isLoggedIn", function( testCompleted )
      {
          csl.isLoggedIn().then( function( partner )
          {
              chai.expect( partner ).to.be.a( "object" );
              testCompleted();
          } )
          .fail( function( error )
          {
               testCompleted( error );
          } );
      } );
  } );
} );

0 个答案:

没有答案
相关问题