Search code examples
node.jsjasmine-node

Why do I get no output from jasmine-node?


I'm running nodejs (v0.10.25) on Ubuntu 14.04. I've installed jasmine-node globally using npm as per the instructions here : http://help.exercism.io/getting-started-with-javascript.html.
My source file is bob.js and my spec file is called bob_test.spec.js.

When I try to run jasmine-node from the command line using:
~$jasmine-node bob_test.spec.js
I get no errors/output/anything from the program. I just get the command line prompt back.

Running which jasmine-node points me to a script located at /usr/local/bin/jasmine-node which contains the following:

#!/usr/bin/env node

if( !process.env.NODE_ENV ) process.env.NODE_ENV = 'test';

var path = require('path');
require(path.join(__dirname,'../lib/jasmine-node/cli.js'));  

My $PATH includes /usr/local/bin:

I have tried:

  • uninstalling/reinstalling jasmine-node packages
  • uninstalling and reinstalling node/nodejs
  • variations on the arguments to jasmine-node such as :
    • jasmine-node .
    • jasmine-node bob.js

Am I missing something in terms of configuration, or something else entirely?


Solution

  • Check that the contents of the script that you're running uses the same command that you're using when you invoke node. For instance, the contents of the jasmine-node script contains:

    #!/usr/bin/env node
    
    if( !process.env.NODE_ENV ) process.env.NODE_ENV = 'test';
    
    var path = require('path');
    require(path.join(__dirname,'../lib/jasmine-node/cli.js'));
    

    The first line contains #!/usr/bin/env node which indicates that node is used to run the code. Verify that node is available and can execute that code.

    Installation on Ubuntu machines can be complicated (since there was an old nodejs binary). I recommend using the following documentation to install Node on an Ubuntu machine: https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager#debian-and-ubuntu-based-linux-distributions

    Specifically it calls out using a different distribution repository. Using this in future installs helps get the correct node binary on the machine and in the PATH.