Javascript 使用Mocha-visit()测试余烬会导致测试中止
运行Javascript 使用Mocha-visit()测试余烬会导致测试中止,javascript,testing,ember.js,phantomjs,mocha.js,Javascript,Testing,Ember.js,Phantomjs,Mocha.js,运行visit()时,余烬转换正确发生: 转换为“auth” 但是,PhantomJs不会加载: [D][“幻影JS”、“onLoadFinished”、“fail”] 如何解决这个问题,为什么visit()不起作用 细节: 在使用yo ember生成的项目中,我有以下测试规范: var assert = chai.assert; var expect = chai.expect; var should = chai.should(); App.rootEle
visit()
时,余烬转换正确发生:
转换为“auth”
但是,PhantomJs不会加载:
[D][“幻影JS”、“onLoadFinished”、“fail”]
如何解决这个问题,为什么visit()
不起作用
细节: 在使用
yo ember
生成的项目中,我有以下测试规范:
var assert = chai.assert;
var expect = chai.expect;
var should = chai.should();
App.rootElement = '#main';
App.setupForTesting();
App.injectTestHelpers();
(function () {
'use strict';
beforeEach(function() {
Ember.run(function() {
App.reset();
});
Ember.testing = true;
});
afterEach(function() {
Ember.testing = false;
});
describe('Basic', function () {
describe('Smoke test', function() {
visit('/auth');
it('Should contain a header', function() {
expect($('.main').length).to.equal(1);
});
});
});
})();
当我运行grunt test--debug
时,我得到以下输出:
[D] ["phantomjs","console","generated -> controller:application [object Object]"]
generated -> controller:application [object Object]
[D] ["phantomjs","console","Rendering application with default view <(subclass of Ember.View):ember650> [object Object]"]
Rendering application with default view <(subclass of Ember.View):ember650> [object Object]
[D] ["phantomjs","console","Rendering auth with <App.AuthView:ember664> [object Object]"]
Rendering auth with <App.AuthView:ember664> [object Object]
[D] ["phantomjs","console","Transitioned into 'auth'"]
Transitioned into 'auth'
[D] ["phantomjs","onLoadFinished","fail"]
[D] ["phantomjs","fail.load","http://localhost:9001/index.html"]
...ERROR
Warning: PhantomJS unable to load "http://localhost:9001/index.html" URI. Use --force to continue.
Aborted due to warnings.
[D][“幻影”、“控制台”、“生成的->控制器:应用程序[对象]”]
生成->控制器:应用程序[对象]
[D] [“phantomjs”、“控制台”、“使用默认视图呈现应用程序[对象]”]
使用默认视图[对象]呈现应用程序
[D] [“phantomjs”、“控制台”、“使用[object]呈现身份验证”]
使用[object object]呈现身份验证
[D] [“幻影”,“控制台”,“转换为'auth'”]
已转换为“auth”
[D] [“phantomjs”、“onLoadFinished”、“fail”]
[D] [“phantomjs”,“fail.load”http://localhost:9001/index.html"]
…错误
警告:PhantomJS无法加载“http://localhost:9001/index.html“乌里。使用--force继续。
由于警告而中止。