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. Windows Service 学习系列(三)——循环引擎 ICycleEngine

    摘要:转载:https://www.cnblogs.com/zhuweisky/archive/2009/09/01/1557792.html#undefined 1.缘起: 有些系统需要每隔一段时间 ...

  2. jquery-插件iCheck 使用

    这是一个兼容多种浏览器的插件 官网:http://icheck.fronteed.com/ 官方给出了很多的例子,我说一个使用的问题. 使用的时候,要放到window..load的外部. 页面html ...

  3. 11-page分页原理

    创建一个分页对象PageBean<T>来存储分页信息+实体信息, 客户端请求时传递分页信息, 服务端将实体信息+分页信息放进分页对象返回给客户端. 实例如下: listStudent.js ...

  4. 24 python初学(异常)

    try, except, else, finally执行顺序:1. 先执行 try 里面的代码块,如果发生异常就会去捕获. 2. 没有错误就会执行 else 里面的信息. 3. 无论怎样都会执行 fi ...

  5. 手把手教你发布一个Python包

    本文主题如下: 编写一个包(Python 源代码),但不是本文的重点. 编译包,观察编译后的文件. 发布包,发布的包可以有多种类型. 如何在 Pypi 中查看已发布的包 注意: 本文编写的包在 Pyt ...

  6. Sublime 禁止自动升级

    打开SUblime   Prefreences  找到"设置-用户" 添加 "update_check":false, 即可禁用默认升级 此时完整如下 { &q ...

  7. Spring 简单使用IoC与DI——XML配置

    目录 Spring简介 导入jar包 Spring配置文件 Spring的IoC IoC简介 快速使用IoC Spring创建对象的三种方式 使用构造方法 使用实例工厂 使用静态静态工厂 Spring ...

  8. linux java 和jmeter 环境变量配置文件笔记(原)

    我在EC2 亚马逊的ubuntu系统下进行的配置,步骤如下(非常简单) 1.在/usr/local下分别新建java和jmeter文件夹,把下载的包进行解压 注:此处有坑,需注意ll -lht  查看 ...

  9. Activiti6作业执行器Job Executor配置(学习笔记)

    内容概况: 异步执行配置相关: asyncExecutorActivate:这个属性是激活作业执行器,它的默认参数是false,只有设为true,activiti启动的时候才会开启线程池去扫描定时操作 ...

  10. Python——装饰器

    1.装饰器形成的过程 2.装饰器的作用 3.原则:开放封闭原则 开放:对扩展是开放的 封闭:对修改是封闭的 4.装饰器的固定模式 def func(): time.sleep(0.01) ') def ...