1

コマンド ラインから Ember テスト スイートを実行すると、タイムアウトになります。私はこれを追跡しました。これajaxCompleteは、への呼び出しによって開始される AJAX 要求に対して発火しないためですvisitが、この同じ要求は、ブラウザーを介して実行するときに完全なイベントを正常に発火します。

イベントはajaxCompleteEmber の呼び出しをトリガーし、それが呼び出されない場合、リクエストが 0 ではないため、メソッドdecrementAjaxPendingRequests中に継続的にスピンします。ここで確認できます。waitTest.pendingAjaxRequests

    function wait(app, value) {
      return Test.promise(function(resolve) {
        // If this is the first async promise, kick off the async test
        if (++countAsync === 1) {
          Test.adapter.asyncStart();
        }

        // Every 10ms, poll for the async thing to have finished
        var watcher = setInterval(function() {
          console.log("watcher tick");
          // 1. If the router is loading, keep polling
          var routerIsLoading = !!app.__container__.lookup('router:main').router.activeTransition;
          if (routerIsLoading) { 
            return; 
          }

          // 2. If there are pending Ajax requests, keep polling
          if (Test.pendingAjaxRequests) { 
            console.log("PENDING AJAX REQUESTS: ", Test.pendingAjaxRequests, " - RETURNING");
            return;
          }

          // 3. If there are scheduled timers or we are inside of a run loop, keep polling
          if (run.hasScheduledTimers() || run.currentRunLoop) {
            return;
         }

          if (Test.waiters && Test.waiters.any(function(waiter) {
            var context = waiter[0];
            var callback = waiter[1];
            return !callback.call(context);
          })) { 
            return;
          }
          // Stop polling
          clearInterval(watcher);


          // If this is the last async promise, end the async test
          if (--countAsync === 0) {
            Test.adapter.asyncEnd();
          }

          // Synchronously resolve the promise
          run(null, resolve, value);
        }, 10);
      });

    }

問題の AJAX リクエストは、私のルートの 1 つのモデル フックからのもので、単純なreturn this.store.find('model_name'). 私は sinon.js を使用してこのリクエストを偽装してthenいます。その検索呼び出しに句を入れると、正しく返されることがわかりますが、まだajaxCompleteイベントが発生していません。

これが私のスタックです:

  • 残り火: 1.7.1
  • Ember データ: 1.0.0-beta.8.2a68c63a
  • ティースプーン (私のテスト ランナー): 0.8.0
  • jQuery: 1.10.2
  • PhantomJS (CLI テスト ランナー): 1.9.7 && 1.8.2

これに未解決の問題があるかどうか、またはスタックの特定の部分が原因である可能性があるかどうか、誰かが知っていますか? 私はここからどこへ行くべきか途方に暮れています。

4

0 に答える 0