Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Run Jasmine testing framework 2.0 from command line for Node project

Previously, I used the npm package node jasmine-node. However, the documentation says it only supports Jasmine 1.3.1.

I'd like to run Jasmine 2.0 tests on a Node project.

I found jasmine-core, which looks like it contains the Jasmine 2.0 libraries, but not the command line runner.

What do I need to do to make this work?

like image 792
Rich Apodaca Avatar asked Feb 12 '14 16:02

Rich Apodaca


People also ask

How do I test in node js with Jasmine?

In order to test a Node. js application, the jasmine framework needs to be installed first. This is done by using the Node package manager. The test code needs to be written in a separate file, and the word 'spec' should be appended to the file name.

Can Jasmine be integrated with node js?

We can install Jasmine for node. js by running npm install jasmine-node -g . We provide the -g option to install it globally, so we're able to run jasmine-node from the command line.


3 Answers

Late response you may know the answer at this point but, try the jasmine-node module 2.0 beta4

Install it via following command

  sudo npm install -g [email protected]

Cheers!

like image 125
Evan Freeman Avatar answered Nov 18 '22 02:11

Evan Freeman


It's now installed without the -beta4 part of the version number

sudo npm install -g [email protected]
like image 45
Ryan W Kan Avatar answered Nov 18 '22 01:11

Ryan W Kan


There is now a https://github.com/jasmine/jasmine-npm

It lacks several of the bells and whistles that jasmine-node has, but

  • it uses the latest https://www.npmjs.com/package/jasmine-core (jasmine-node uses jasmime 2.0 as of February 2015, while jasmine-npm uses jasmine 2.2).
  • it comes from the jasmine maintainers themselves
like image 37
xverges Avatar answered Nov 18 '22 01:11

xverges