1

I need to be able to run unit test for my Node.js application, I decide to use Jasmine framework, because I know t and think it's pretty well solution. But before I use karma as my test runner, but karma do not works for server side development. So, please, advice me a good way to develop unit test for Node.js with Jasmine

2 Answers 2

2

im currently using this project to run mt jasmine's test https://github.com/mhevery/jasmine-node

you simply need to exec this : jasmine-node path/to/your/specs

May be this is not the best tools for running jasmine specs but i use it because it supports coffescript written specs (jasmine-node --coffee specs/

and finally you could use it to make starting "script" like run test before any action

jasmine-node specs/specs1.js && jasmine-node specs/specs2.js && node server.js for example

an other cool tool i use is rewire https://github.com/jhnns/rewire that allow you to mock some methods fir unit testing

i hope it might help you

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

1 Comment

Unfortunately, for now jasmine-node is outdated, it supports Jasmine 2.0, but not 2.1+.
2

According to Jasmine documentation you can use 'jasmine' node package. Running jasmine init will create basic jasmin.json configuration file, where you can list all your specs.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.