gruntjs / grunt-lib-phantomjs

Grunt and PhantomJS, sitting in a tree.
http://gruntjs.com/
MIT License
93 stars 63 forks source link

PhantomJS timed out #69

Closed squarewave24 closed 8 years ago

squarewave24 commented 10 years ago

Hello,

I am following a setup from this example: http://seesparkbox.com/foundry/grunt_automated_testing

and I've tried multiple versions of phantom.js but ineviteably get stuck with this timeout problem.

It is actually not clear to me where i'd set the url for phantom to call. someone suggested qunit on another post, but i am not using a qunit. and where i could set the proxy (even though it's calling localhost).. but it may be related to it trying to call non localhost address, since i didn't actually set it anywhere?

Here is the error i see:

$ grunt test -dd
[D] ["phantomjs","onResourceRequested" ..........
[D] ["phantomjs","fail.timeout"]

Warning: PhantomJS timed out, possibly due to an unfinished async spec. Use --force to continue.

adding my gruntfile.js

module.exports = function (grunt) {

    grunt.initConfig({
        pkg: grunt.file.readJSON("package.json"),
        watch: {
            grunt: {
                files: ["Gruntfile.js", "package.json"],
                tasks: "default"
            },
            javascript: {
                files: ["app/**/*.js", "app/**/**/*.js", "tests/spec/*Spec.js", "*.jshintrc"],
                tasks: "test"
            }
        },
        jasmine: {
            src: "tests/lib/jasmine-1.0.0/*.js",
            options: {
                specs: "tests/spec/*Spec.js",
//                host: "http://localhost:62310/tests/specrunner.html",
                template: require("grunt-template-jasmine-requirejs"),
                '--web-security': false,
                '--local-to-remote-url-access': true,
                '--ignore-ssl-errors': true
            }
        },
        jshint: {
            all: [
              "Gruntfile.js","app/**/*.js", "app/**/**/*.js"
            ],
            options: {
                jshintrc: "options.jshintrc"
            }
        },
        mochacli: {
            options: {reporter: "nyan", ui: "tdd"},
            all: ["tests/spec/*Spec.js"]
        }
        ,
        qunit: {
            all: {
                options: {
                    urls: [
                      'http://localhost:62310/tests/specrunner.html'
                    ]
                }
            }
        }
    });
    grunt.loadNpmTasks('grunt-template-jasmine-requirejs');
    grunt.loadNpmTasks("grunt-contrib-watch");
    grunt.loadNpmTasks("grunt-contrib-jshint");
    grunt.loadNpmTasks("grunt-contrib-jasmine");
    grunt.loadNpmTasks("grunt-mocha-cli");
    grunt.registerTask("test", [
        "jshint"
        , "jasmine"
        //,"mochacli"
    ]);
    grunt.registerTask("default", ["test"]);
};
Arkni commented 8 years ago

Are you still encountering this issue ?

From what I can tell, you didn't setup a local web server, because you have urls in your gruntfile. Note that urls must be served by a web server, and since jasmine task doesn't contain a web server, one will need to be configured separately. The grunt-contrib-connect plugin provides a basic web server.

Going to close this issue, feel free to ask if you have followup questions.