What is the purpose of jasmine-node?
Asked Answered
K

1

6

I can run my specs with either jasmine-node or just jasmine. They both run my specs. So, what value does jasmine-node add? The readme says:

This node.js module makes the wonderful Pivotal Lab's jasmine spec framework available in node.js. https://github.com/mhevery/jasmine-node/blob/master/README.md

I don't understand. My app runs on node, my specs require node modules .. so when I run jasmine, I'm already using both node and jasmine. What does jasmine-node add?

I specifically am not asking for opinions about why jasmine-node is your favorite, or recommendations of other libraries. I only want to know, what is the purpose of jasmine-node?

Kilauea answered 17/11, 2015 at 21:1 Comment(1)
The main diference is possibility of running coffeescript tests.Ejectment
Y
2

The subtitle of jasmine-node is a good answer to your question:

DOM-less simple JavaScript BDD testing framework for Node

Let's go and look at the different parts of the answer:

DOM-less simple testing framework

jasmine is a JS testing tool. At the beginning JS was just for browsers. To give an output inside the browser there is this DOM Model, which is not so easy to use. Node.js gives you the possibility to run JS also on a server. On the server-side there is no DOM. To make things faster and easier you don't need a DOM implementation for your testing tool, when it just runs inside node.js

Jasmine itself is independent of a browser, so that is an intention for both jasmine and jasmine-node.

for Node

This is easy - jasmine-node is just for node and not for browser JS.

But behind that part there is the main purpose. Because the requirements between a brwoser test and a node.js test are totaly different. Because jamsine supports both ways it can not have all features, which are possible with node. If you look at the possible arguments at the documentation you see that there are much more options inside the CLI of jasmine-node. Some of the most interesting features are maybe:

  • Test a file automaticaly, when it changes
  • test coffeescript files directly

So to give you an answer to your question:

What is the purpose of jasmine-node?

jasmine-node provides you more CLI options for you tests. It can make some work automaticaly and it uses more of the node functions to provide that. So the future way for jasmine-node will be in providing more functions, which are just able to implement, when you just test on node.js

Yemen answered 18/12, 2015 at 9:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.