Node.js 使用摩卡、Velocity和Meteor进行无限重定向

Node.js 使用摩卡、Velocity和Meteor进行无限重定向,node.js,meteor,phantomjs,reactjs,mocha.js,Node.js,Meteor,Phantomjs,Reactjs,Mocha.js,我正在尝试使用mocha和PhantomJS来运行一些集成测试,而不需要打开一个新窗口。我的代码看起来像: var waitForAccounts = function(callback) { if (Accounts.loginServicesConfigured()) { callback(); } else { setTimeout(function() { waitForAccounts(callback); }, 10); } } va

我正在尝试使用mocha和PhantomJS来运行一些集成测试,而不需要打开一个新窗口。我的代码看起来像:

var waitForAccounts = function(callback) {
  if (Accounts.loginServicesConfigured()) {
    callback();
  } else {
    setTimeout(function() {
      waitForAccounts(callback);
    }, 10);
  }
}

var waitForLogin = function(callback) {
  if (!!Meteor.user()) {
    callback();
  } else {
    setTimeout(function() {
      waitForLogin(callback)
    }, 10);
  }
}

if (!(typeof MochaWeb === 'undefined')){
  MochaWeb.testOnly(function(){
    describe("Menu bar", function(){
      it("should have the correct title", function() {
        expect($('.navbar-brand').html()).to.equal('Lynx');
      });

      describe('when logged in', function() {
        beforeEach(function(done) {
          waitForAccounts(function() {
            if (!Meteor.user()) {
              Meteor.loginWithFacebook({
                loginStyle: 'redirect'
              });
              waitForLogin(function() {
                console.log('User:', Meteor.user());
                done();
              });           
            } else {
              done();
            }            
          });
        });

        it('should have a logout link', function() {
            expect($('#logout').html()).to.exist;
            expect($('#login').html()).to.be.undefined;
        });
      });
    });
  });
});
我猜这与每次页面加载时重新加载代码有关,这是在帐户登录时发生的(目前有一个代理伪造并自动接受fb oauth)。我只是不确定此时如何解决它


UI使用ReactJS编写,后端/反应性使用Meteor编写。

弹出窗口似乎也不起作用,因为当我将登录样式切换到弹出窗口时,它不再卡在无限循环中,但弹出窗口没有关闭,因此超时。