我目前正在尝试将GruntJS与一些插件(PhantomJS Qunit和Connect插件)合并.但是,设置一个简单的测试会给我带来错误,尽管经过几天的搜索,我找不到解决方案.我正在使用本地Web服务器(MAMP),该网站正在CMS上运行.
通过在浏览器中访问测试模板来运行测试工作正常,但是当尝试使用sudo grunt testPhantomJS 通过命令行访问相同的工具时返回一个奇怪的错误:
Running "qunit:all" (qunit) task
Testing http://user-guides:80/test/test.html
Warning: PhantomJS timed out, possibly due to a missing QUnit start() call. Use --force to continue.
Aborted due to warnings.
Run Code Online (Sandbox Code Playgroud)
我的一些搜索让人们降级他们的phantom.js版本来处理类似的问题,但到目前为止,这些解决方案都没有对我有用,我担心我会在面前丢失一些东西.
这是我的Gruntfile.js的内容
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
connect: {
server: {
options: {
hostname: 'user-guides',
port: 80,
base: 'public'
}
}
},
jshint: {
all: ['Gruntfile.js', 'public/assets/js/helper/*.js', 'public/assets/js/specific/*.js']
},
qunit: {
all: {
options: {
timeout: 5000,
urls: [
'http://user-guides:80/test/test.html',
]
}
}
} …Run Code Online (Sandbox Code Playgroud)