Ember.js 找不到变量:使用ember cli简单身份验证测试的invalidateSession

Ember.js 找不到变量:使用ember cli简单身份验证测试的invalidateSession,ember.js,ember-simple-auth,Ember.js,Ember Simple Auth,我正在使用ember cli简单身份验证,并使用ember cli简单身份验证测试进行测试。我已经按照安装测试库的步骤进行了操作 tests/helpers/start-app.js包含: import Ember from 'ember'; import Application from '../../app'; import Router from '../../router'; import config from '../../config/environment'; import '

我正在使用ember cli简单身份验证,并使用ember cli简单身份验证测试进行测试。我已经按照安装测试库的步骤进行了操作

tests/helpers/start-app.js包含:

import Ember from 'ember';
import Application from '../../app';
import Router from '../../router';
import config from '../../config/environment';

import 'simple-auth-testing/test-helpers';

export default function startApp(attrs) {
  var application;

  var attributes = Ember.merge({}, config.APP);
  attributes = Ember.merge(attributes, attrs); // use defaults, but you can override;

  Ember.run(function() {
    application = Application.create(attributes);
    application.setupForTesting();
    application.injectTestHelpers();
  });

  return application;
}
...
if (environment === 'test') {
  // Testem prefers this...
  ENV.baseURL = '/';
  ENV.locationType = 'none';

  // keep test console output quieter
  ENV.APP.LOG_ACTIVE_GENERATION = false;
  ENV.APP.LOG_VIEW_LOOKUPS = false;

  ENV.APP.rootElement = '#ember-testing';

  ENV['simple-auth'] = {
    store: 'simple-auth-session-store:ephemeral'
  }
}
...
config/environment.js包含:

import Ember from 'ember';
import Application from '../../app';
import Router from '../../router';
import config from '../../config/environment';

import 'simple-auth-testing/test-helpers';

export default function startApp(attrs) {
  var application;

  var attributes = Ember.merge({}, config.APP);
  attributes = Ember.merge(attributes, attrs); // use defaults, but you can override;

  Ember.run(function() {
    application = Application.create(attributes);
    application.setupForTesting();
    application.injectTestHelpers();
  });

  return application;
}
...
if (environment === 'test') {
  // Testem prefers this...
  ENV.baseURL = '/';
  ENV.locationType = 'none';

  // keep test console output quieter
  ENV.APP.LOG_ACTIVE_GENERATION = false;
  ENV.APP.LOG_VIEW_LOOKUPS = false;

  ENV.APP.rootElement = '#ember-testing';

  ENV['simple-auth'] = {
    store: 'simple-auth-session-store:ephemeral'
  }
}
...
在测试中调用invalidateSession时,出现以下错误:

Acceptance | items: the route /items is inaccessible when the session is not authenticated
✘ Died on test #1     at http://localhost:7357/assets/test-support.js:2688
    at http://localhost:7357/assets/wishlist.js:2055
    at http://localhost:7357/assets/vendor.js:150
    at tryFinally (http://localhost:7357/assets/vendor.js:30)
    at http://localhost:7357/assets/vendor.js:156
    at http://localhost:7357/assets/test-loader.js:29
    at http://localhost:7357/assets/test-loader.js:21
    at http://localhost:7357/assets/test-loader.js:40
    at http://localhost:7357/assets/test-support.js:5460: Can't find variable: invalidateSession

我一定做错了什么。它是什么?

0.8.0-beta.2的正确导入是:

import initializeTestHelpers from 'simple-auth-testing/test-helpers';
initializeTestHelpers();

export default function startApp(attrs) {