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早已不是那些寥寥几行的视觉效果代码.代码量的大增,多人协同,人员素质悬殊不齐,这都需要一个标准,来对代 ...
随机推荐
- bibli直播弹幕实时爬取
1 分析数据来源 在不知道弹幕信息在哪里的时候,只能去all里面查看每一个相应的信息,看信息是否含有弹幕信息 在知道弹幕信息文件的时候,我们可以直接用全局文件搜索,定位到弹幕数据文件.操作如下图 2 ...
- SQL AUTO INCREMENT 字段
Auto-increment 会在新记录插入表中时生成一个唯一的数字. AUTO INCREMENT 字段 我们通常希望在每次插入新记录时,自动地创建主键字段的值. 我们可以在表中创建一个 auto- ...
- Android 动态设置TextView的drawableLeft等属性
首先,我们在开发过程中,会经常使用到android:drawableLeft="@drawable/ic_launcher"这些类似的属性: 关于这些属性的意思,无非是在你的tex ...
- 监控redis
[4ajr@redis1 scripts]$ cat redismonitor.sh #!/bin/bash #想要什么监控项再添加 rediscli="/soft/redis/bin/re ...
- C# 使用DES对字符串进行加密
1.DES加密是属于对称加密,加密和解密使用的密钥必须要保持一致,且必须为8位,使用前首先添加引用: 2.逻辑实现代码如下:
- android 图片上传图片 报Socket: Broken pipe
上传图片的时候报如下错误: 上传失败的原因是服务器限制了文件上传的大小.让服务端改一下配置文件就好了
- 迷茫<第二篇:回到老家湖南长沙>
2014年8月初,我买了回老家的火车票,当时没有买到坐票,卧铺贵了买不起,所以我就选择了站票,准备站回老家.我现在还记得我当时买的是T1列火车,北京西站到长沙火车站,全程16个小时.当时我就在火车上站 ...
- AWT的应用
AWT(Abstract Window TookIT)是java用于创建用户界面和绘制图形的所有类 AWT组件和容器 AWT包含了很多类和接口,用于java Application的GUI(图形用户界 ...
- Java的clone():深复制与浅复制
Java中要想自定义类的对象可以被复制,自定义类就必须实现Cloneable中的clone()方法,如下: public class Student implements Cloneable { pr ...
- Python——逻辑运算(or,and)
print(0 and 2 > 1) #结果0 print(0 and 2 < 1) #结果0 print(1 and 2 > 1) #结果True print(1 and 2 &l ...