Jasmine

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:
NameTypeDescription
descriptionString

Textual description of the group

specDefinitionsfunction

Function for Jasmine to invoke that will define inner suites and specs

expect(actual) → {matchers}

Create an expectation for a spec.

Parameters:
NameTypeDescription
actualObject

Actual computed value to test expectations against.

转载于:https://www.cnblogs.com/lightsong/p/9416911.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值