2

Gruntfile.js content:

grunt.initConfig({
        connect: {
            server: {
                options: {
                    port: 5005,
                    base: '.'
                }
            }
        },
        qunit: {
            all: ['test/*.html']
        }
    });

grunt.loadNpmTasks('grunt-contrib-connect');
    grunt.loadNpmTasks('grunt-contrib-qunit');

grunt.registerTask('test', ['connect', 'qunit']);

Test/index.html file content:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>
            Sitejson - QUnit Test Runner
        </title>
        <link rel="stylesheet" href="libs/qunit/qunit.css" type="text/css">
    </head>
    <body>
        <div id="qunit"></div>
        <div id="qunit-fixture"></div>

        <script src="libs/qunit/qunit.js" type="text/javascript"></script>
        <script src="testcases/tests.js" type="text/javascript"></script>
    </body>
</html>

tests.js content:

QUnit.test("hello test", function(assert) {
    assert.ok(1 == "1", "Passed!");
});

I am working on Ubuntu / Linux environment. I have also installed Phantomjs and is working fine. Whenever i try to run grunt test I'm receiving a fatal error: spawn ENOENT error.

whereas i try running it on browser its qunit is working fine...

I am not able to identify what the issues. Am i missing some more configuration over here.

grunt test --debug shows me:

Running "connect:server" (connect) task
[D] Task source: /media/hegdeashwin/Storage-TB/qunittesting/node_modules/grunt-contrib-connect/tasks/connect.js
Started connect web server on http://0.0.0.0:5005

Running "qunit:all" (qunit) task
[D] Task source: /media/hegdeashwin/Storage-TB/qunittesting/node_modules/grunt-contrib-qunit/tasks/qunit.js
Testing test/index.html [D] ["/media/hegdeashwin/Storage-TB/qunittesting/node_modules/grunt-contrib-qunit/node_modules/grunt-lib-phantomjs/phantomjs/main.js","/tmp/1405775714604.2773","test/index.html","{\"timeout\":5000,\"inject\":\"/media/hegdeashwin/Storage-TB/qunittesting/node_modules/grunt-contrib-qunit/phantomjs/bridge.js\",\"urls\":[],\"force\":false,\"console\":true,\"httpBase\":false}"]
Fatal error: spawn EACCES

1 Answer 1

1

Use the following process:

  • set the tmpdir environment variable:

    setenv TMPDIR=~/tmp
    
  • Rerun the grunt task

  • If it works, set this permanently by adding the following to your .bashrc or .profile:

    export TMPDIR=~/tmp
    

References

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.