简体   繁体   English

茉莉花结的目的是什么?

[英]What is the purpose of jasmine-node?

I can run my specs with either jasmine-node or just jasmine . 我可以使用jasmine-nodejasmine运行我的规格。 They both run my specs. 他们都符合我的规格。 So, what value does jasmine-node add? 那么, jasmine-node增加了什么价值? The readme says: 自述文件说:

This node.js module makes the wonderful Pivotal Lab's jasmine spec framework available in node.js. 这个node.js模块使出色的Pivotal Lab的茉莉花规格框架可在node.js中使用。 https://github.com/mhevery/jasmine-node/blob/master/README.md 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 . 我的应用程序在node运行,我的规范require node模块..所以当我运行jasmine ,我已经在使用nodejasmine What does jasmine-node add? jasmine-node添加了什么?

I specifically am not asking for opinions about why jasmine-node is your favorite, or recommendations of other libraries. 我特别不是在询问为什么您最喜欢jasmine-node观点或其他图书馆的建议。 I only want to know, what is the purpose of jasmine-node ? 我只想知道, jasmine-node目的是什么?

The subtitle of jasmine-node is a good answer to your question: 茉莉花节点的副标题是对您的问题的一个很好的答案:

DOM-less simple JavaScript BDD testing framework for Node 适用于Node的无DOM的简单JavaScript BDD测试框架

Let's go and look at the different parts of the answer: 让我们来看一下答案的不同部分:

DOM-less simple testing framework 无需DOM的简单测试框架

jasmine is a JS testing tool. jasmine是一个JS测试工具。 At the beginning JS was just for browsers. 最初,JS仅用于浏览器。 To give an output inside the browser there is this DOM Model, which is not so easy to use. 为了在浏览器中提供输出,有一个DOM模型,它并不是那么容易使用。 Node.js gives you the possibility to run JS also on a server. Node.js使您还可以在服务器上运行JS。 On the server-side there is no DOM. 在服务器端没有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 为了使事情变得更快,更轻松,当测试工具仅在node.js中运行时,您不需要DOM实现

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. 这很容易-茉莉花节点仅用于节点而不是浏览器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. 因为brwoser测试和node.js测试之间的要求完全不同。 Because jamsine supports both ways it can not have all features, which are possible with node. 因为jamsine支持这两种方式,所以它不能具有节点具有的所有功能。 If you look at the possible arguments at the documentation you see that there are much more options inside the CLI of jasmine-node. 如果您查看文档中的可能参数,您会发现jasmine-node的CLI内还有更多选项。 Some of the most interesting features are maybe: 一些最有趣的功能可能是:

  • Test a file automaticaly, when it changes 更改时自动测试文件
  • test coffeescript files directly 直接测试coffeescript文件

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. jasmine-node为您提供了更多CLI选项供您测试。 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 因此,当您在node.js上进行测试时,茉莉花节点的未来方式将是提供更多能够实现的功能

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM