Jasmine
Jasmine
https://www.npmjs.com/package/jasmine
The Jasmine Module
The
jasminemodule is a package of helper code for developing Jasmine projects for Node.js.The core of jasmine lives at https://github.com/jasmine/jasmine and is
jasmine-corein npm.Contents
This module allows you to run Jasmine specs for your Node.js code. The output will be displayed in your terminal by default.
Installation
# Local installation:npm install --save-dev jasmine# Global installationnpm install -g jasmineInitializing
To initialize a project for Jasmine
jasmine initTo seed your project with some examples
jasmine exampleshttps://jasmine.github.io/setup/nodejs.html
Note that if you installed Jasmine locally you could still use the command line like this:
node node_modules/jasmine/bin/jasmine init
DEMO
describe("A suite", function() {
it("contains spec with an expectation", function() {
expect(true).toBe(true);
});
});

API
https://jasmine.github.io/api/3.0/global.html#expect
describe(description, specDefinitions)
Create a group of specs (often called a suite).
Calls to describe can be nested within other calls to compose your suite as a tree.
Parameters:
| Name | Type | Description |
|---|---|---|
description |
String |
Textual description of the group |
specDefinitions |
function |
Function for Jasmine to invoke that will define inner suites and specs |
expect(actual) → {matchers}
Create an expectation for a spec.
Parameters:
| Name | Type | Description |
|---|---|---|
actual |
Object |
Actual computed value to test expectations against. |
Jasmine的更多相关文章
- jasmine入门
本文来自http://blog.fens.me/nodejs-jasmine-bdd 粉丝日志 张丹 前言TDD(Test Driven Development)测试驱动开发,是敏捷开发中提出的最 ...
- angularjs自动化测试系列之jasmine
angularjs自动化测试系列之jasmine jasmine参考 html <!DOCTYPE html> <html lang="en"> <h ...
- Karma+Jasmine实现自动化单元测试
1.Karma介绍 Karma是Testacular的新名字,在2012年google开源了Testacular,2013年Testacular改名为Karma.Karma是一个让人感到非常神秘的名字 ...
- JavaScript测试工具比较: QUnit, Jasmine, and Mocha
1. QUnit A JavaScript Unit Testing framework. QUnit is a powerful, easy-to-use JavaScript unit testi ...
- 基于Angularjs+jasmine+karma的测试驱动开发(TDD)实例
简介(摘自baidu) 测试驱动开发,英文全称Test-Driven Development,简称TDD,是一种不同于传统软件开发流程的新型的开发方法.它要求在编写某个功能的代码之前先编写测试代码,然 ...
- Jasmine测试ng Promises - Provide and Spy
jasmine提供了很多些很实用的处理Promises的方法,首先我们来考虑下面的这个例子: angular.module("myApp.store").controller(&q ...
- Jasmine入门(上)
什么是Jasmine Jasmine是一个Javascript的BDD(Behavior-Driven Development)测试框架,不依赖任何其他框架. 如何使用Jasmine 从Github上 ...
- Jasmine入门(结合示例讲解)
参考: http://www.cnblogs.com/wushangjue/p/4541209.html http://keenwon.com/1191.html http://jasmine.git ...
- angular测试-Karma + Jasmine配置
首先讲一下大致的流程: 需要node环境,首先先要安装node,node不会?请自行搜索.版本>0.8 安装node完成之后先要测试下npm是否测试通过,如下图所示 首先看下目录结构 目录为:F ...
- 使用jasmine来对js进行单元测试
互联网的快速发展,给web开发人员带来了前所未有的挑战.对于前端开发,前端开发er所需要编写的js早已不是那些寥寥几行的视觉效果代码.代码量的大增,多人协同,人员素质悬殊不齐,这都需要一个标准,来对代 ...
随机推荐
- git如何设置ssh密钥
git设置ssh密钥 目前git支持https和git两种传输协议,github分享链接时会有两种协议可选: 1.Clone with SSH 2.Clone with HTTPS git在使用htt ...
- spring异步执行报异常No qualifying bean of type 'org.springframework.core.task.TaskExecutor' available
最近观察项目运行日志的时候突然发现了一个异常, [2018-04-03 10:49:07] 100.0.1.246 http-nio-8080-exec-9 DEBUG org.springframe ...
- Python从入门到放弃Day01
Py的第一天,无非是讲一些关于电脑的一些常见的基本常识,硬件之类的cpu啊.硬盘啊.显卡啊.内存条啊什么的,之后就还有一些除了windows之外的操作系统,我之前是学网络的,Readhat也学了一部分 ...
- A. Points in Segments(cf a题, 水题)
没什么好说的 #include<iostream> using namespace std; ], x, y,n, m, ans; int main(){ cin>>n> ...
- leetcode 263. Ugly Number 、264. Ugly Number II 、313. Super Ugly Number 、204. Count Primes
263. Ugly Number 注意:1.小于等于0都不属于丑数 2.while循环的判断不是num >= 0, 而是能被2 .3.5整除,即能被整除才去除这些数 class Solution ...
- wps for linux显示系统缺失字体解决办法
1.下载字体库 链接: https://pan.baidu.com/s/1xil5_i9M53fM7EQNIt3Mcw 密码: jqnu 2.解压 sudo unzip wps_symbol_font ...
- 怎么在Vue的某个组件中根据组件tag标签名获取到对应的VueComponent实例呢
1.以前玩omi框架的时候,有Omi.get方法来获取实例, ...好久没玩了,忘了.反正很喜欢该方法.2.如今想在vue里面怎么能够快速获取到对应组件标签名的的实例呢?3.文档也看过,似乎脑海中没啥 ...
- python线程join方法
转载:http://www.cnblogs.com/cnkai/p/7504980.html Python多线程与多进程中join()方法的效果是相同的. 下面仅以多线程为例: 首先需要明确几个概念: ...
- Flutter之SliverAppBar
new SliverAppBar( leading: GestureDetector( child: Icon(Icons.arrow_back), onTap: () => Navigator ...
- socket之黏包
一.黏包成因 1.tcp协议的拆包机制 当发送端缓冲区的长度大于网卡的MTU时,tcp会将这次发送的数据拆成几个数据包发送出去. MTU是Maximum Transmission Unit的缩写.意思 ...