Proxy configuration for PhantomJS through grunt (qunit) -
i'm attempting run integration tests via grunt-contrib-qunit. i've set --proxy
flag via options
object, every ajax request returns 404 (not found) error.
gruntfile.js
grunt.loadnpmtasks('grunt-contrib-qunit'); ... grunt.initconfig({ qunit: { options: { '--local-to-remote-url-access': true, '--proxy': '192.168.1.1:8080' }, all: [ 'test/**/*.html' ] }, ... }); ... grunt.registertask('test', [ 'clean:server', 'compass', 'connect:test', 'qunit:all' ]);
the qunit test fails 404 on trivial ajax request:
test/index.html
test('works', function() { stop(); $.ajax({ url: '/svc/version', success: function() { ok(true, 'yippee'); start(); }, error: function(xhr) { console.log('error: ' + xhr.status); } }); });
fails with:
running "qunit:all" (qunit) task testing test/index.htmlerror: 404
it's worth noting explicitly referencing host (url: 'http://192.168.1.1:8080/svc/version'
) works fine, it's not same-origin issue.
references: grunt-contrib-qunit, phantomjs, grunt-lib-phantomjs, so "proxy in phantomjs"
Comments
Post a Comment