Requirejs 在摩卡测试中需要幻影
我正试图与摩卡幻影一起起步,我似乎在需求方面遇到了障碍。我希望其他人能看到我做错了什么Requirejs 在摩卡测试中需要幻影,requirejs,phantomjs,mocha.js,Requirejs,Phantomjs,Mocha.js,我正试图与摩卡幻影一起起步,我似乎在需求方面遇到了障碍。我希望其他人能看到我做错了什么 $ mocha-phantomjs test/index.html My Site 1) server should be running Error: Script error for: webpage http://requirejs.org/docs/errors.html#scripterror 所涉及的文件相当小: 以下是规范脚本: test.spec.js 我尝试了各种形式的define/r
$ mocha-phantomjs test/index.html
My Site
1) server should be running
Error: Script error for: webpage
http://requirejs.org/docs/errors.html#scripterror
所涉及的文件相当小:
以下是规范脚本:
test.spec.js
我尝试了各种形式的define/require,但都没有完全正确。是否存在404或其他HTTP错误?看起来您需要从浏览器加载的脚本中调用
网页
模块,而该模块可能只应用作节点模块。是否可以包含网页
脚本?网页
来自phantomjs。
describe("My Site", function() {
it("server should be running", function(done) {
require(['webpage'], function(webpage) {
var page = webpage.create();
page.open("http://localhost:8080/", function() {
var title = page.evaluate(function () {
return document.title;
});
title.should.eql('My Title');
console.log("Title: " + title);
phantom.exit();
done();
});
});
}); // server should be running
});