【发布时间】:2016-10-13 15:42:57
【问题描述】:
我正在尝试为我的应用程序编写一个测试,并且我正在使用 Karma 将文件加载到 PhantomJS 中。问题是其中一个文件由于窗口变量而导致页面重新加载。
文件是这样包含的:
files: [
'bower_components/angular/angular.js',
'js/**/*.js'
]
主应用程序文件 (main.js) 包含以下内容:
if ( window.top !=== window.self ){
window.location.href = 'someOtherURL.html';
}
// PhantomJS 2.1.1 ERROR
// Some of your tests did a full page reload!
所以我的测试都没有运行,因为包含这个文件会因页面重新加载而停止执行。
我的问题是,如何设置窗口变量以便运行此测试?
【问题讨论】:
标签: javascript angularjs phantomjs karma-runner