通过grunt(qunit)为PhantomJS配置代理

通过grunt(qunit)为PhantomJS配置代理,phantomjs,qunit,gruntjs,grunt-contrib-qunit,Phantomjs,Qunit,Gruntjs,Grunt Contrib Qunit,我正在尝试通过运行集成测试。我通过options对象设置了-proxy标志,每个ajax请求都返回一个404NotFound错误 Grunfile.js QUnit测试本身失败,在最简单的AJAX请求上出现404错误: test/index.html 在以下情况下失败: Running "qunit:all" (qunit) task Testing test/index.htmlError: 404 值得注意的是,显式引用主机url:'http://192.168.1.1:8080/svc/

我正在尝试通过运行集成测试。我通过options对象设置了-proxy标志,每个ajax请求都返回一个404NotFound错误

Grunfile.js

QUnit测试本身失败,在最简单的AJAX请求上出现404错误:

test/index.html

在以下情况下失败:

Running "qunit:all" (qunit) task
Testing test/index.htmlError: 404
值得注意的是,显式引用主机url:'http://192.168.1.1:8080/svc/version“效果很好,所以这不是同一来源问题

参考文献:

test('Works', function() {
  stop();
  $.ajax({
    url: '/svc/version',
    success: function() {
      ok(true, 'yippee');
      start();
    },
    error: function(xhr) {
      console.log('Error: ' + xhr.status);
    }
  });
});
Running "qunit:all" (qunit) task
Testing test/index.htmlError: 404