Jasmine

https://www.npmjs.com/package/jasmine

The Jasmine Module

The jasmine module 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-core in 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 installation 
npm install -g jasmine

Initializing

To initialize a project for Jasmine

jasmine init

To seed your project with some examples

jasmine examples

https://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的更多相关文章

  1. jasmine入门

    本文来自http://blog.fens.me/nodejs-jasmine-bdd 粉丝日志 张丹   前言TDD(Test Driven Development)测试驱动开发,是敏捷开发中提出的最 ...

  2. angularjs自动化测试系列之jasmine

    angularjs自动化测试系列之jasmine jasmine参考 html <!DOCTYPE html> <html lang="en"> <h ...

  3. Karma+Jasmine实现自动化单元测试

    1.Karma介绍 Karma是Testacular的新名字,在2012年google开源了Testacular,2013年Testacular改名为Karma.Karma是一个让人感到非常神秘的名字 ...

  4. JavaScript测试工具比较: QUnit, Jasmine, and Mocha

    1. QUnit A JavaScript Unit Testing framework. QUnit is a powerful, easy-to-use JavaScript unit testi ...

  5. 基于Angularjs+jasmine+karma的测试驱动开发(TDD)实例

    简介(摘自baidu) 测试驱动开发,英文全称Test-Driven Development,简称TDD,是一种不同于传统软件开发流程的新型的开发方法.它要求在编写某个功能的代码之前先编写测试代码,然 ...

  6. Jasmine测试ng Promises - Provide and Spy

    jasmine提供了很多些很实用的处理Promises的方法,首先我们来考虑下面的这个例子: angular.module("myApp.store").controller(&q ...

  7. Jasmine入门(上)

    什么是Jasmine Jasmine是一个Javascript的BDD(Behavior-Driven Development)测试框架,不依赖任何其他框架. 如何使用Jasmine 从Github上 ...

  8. Jasmine入门(结合示例讲解)

    参考: http://www.cnblogs.com/wushangjue/p/4541209.html http://keenwon.com/1191.html http://jasmine.git ...

  9. angular测试-Karma + Jasmine配置

    首先讲一下大致的流程: 需要node环境,首先先要安装node,node不会?请自行搜索.版本>0.8 安装node完成之后先要测试下npm是否测试通过,如下图所示 首先看下目录结构 目录为:F ...

  10. 使用jasmine来对js进行单元测试

    互联网的快速发展,给web开发人员带来了前所未有的挑战.对于前端开发,前端开发er所需要编写的js早已不是那些寥寥几行的视觉效果代码.代码量的大增,多人协同,人员素质悬殊不齐,这都需要一个标准,来对代 ...

随机推荐

  1. HTML5 canvas clearRect() 方法

    浏览器支持 Internet Explorer 9.Firefox.Opera.Chrome 以及 Safari 支持 clearRect() 方法. 注释:Internet Explorer 8 或 ...

  2. Java 控制语句

    Java 控制语句

  3. 2019年美国大学生数学建模竞赛(MCM/ICM) E题解题思路

    这也许是我大学生涯最后一次参加数学建模比赛了吧,这次我们选择的问题是E题,以下是我们解题时候的一些思路.很多不易体现的项目产生对环境造成影响的指标可以由一些等同类型的指标来代替,如土地.森林植被被破环 ...

  4. H5 百度一下,你就知道

    <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8&quo ...

  5. Nginx部署静态页

    简答说一下如何用Nginx部署静态网页,并绑定域名访问 1.通过FTP上传静态页到服务器指定目录 2.编写nginx的.conf文件 3.重启nginx 如图,这是centos上传文件路径 nginx ...

  6. opentack-openstack组件及功能(1)

    一. OpenStack各组件间的关系 图22.1 OpenStack各组件间的关系 1.基础管理服务包含Keystone,Glance,Nova,Neutron,Horizon五个服务 (1)Key ...

  7. es6可变参数-扩展运算符

    es5中参数不确定个数的情况下: //求参数和 function f(){ var a = Array.prototype.slice.call(arguments); var sum = 0; a. ...

  8. CRM专业术语

    客户关系管理(管理学词汇CRM)_百度百科https://baike.baidu.com/item/%E5%AE%A2%E6%88%B7%E5%85%B3%E7%B3%BB%E7%AE%A1%E7%9 ...

  9. Python——Set集合

    一.定义 Set集合用于表示相互之间无需的一种组合对象,包括:并集.交集.补集 二.集合的两种模式 sample = set()  初始化普通集合 sample = frozenset() 初始化不可 ...

  10. [模板] 积性函数 && 线性筛

    积性函数 数论函数指的是定义在正整数集上的实或复函数. 积性函数指的是当 \((a,b)=1\) 时, 满足 \(f(a*b)=f(a)*f(b)\) 的数论函数. 完全积性函数指的是在任何情况下, ...