mocha-context

2019-11-22 admin

mocha-context是什么

什么是mocha-context,Pass this context as the first argument of the arrow function.

mocha-context使用教程帮助文档

mocha-context

Build Status Coverage Status install size

Pass this context as the first argument of the arrow function.

Installation

npm install -D mocha-context

Usage

You can import patched functions from this module:

const {it} = require("mocha-context");

describe("my test", () => {
  it("skip me", t => {
    t.skip();
  });
});

Or replace global functions by requiring mocha-context/register:

require("mocha-context/register");

describe("my test", () => {
  it("skip me", t => {
    t.skip();
  });
});

You can tell mocha to --require the library from CLI, so you don’t have to require() it manually:

$ mocha -r mocha-context/register
describe("my test", () => {
  it("skip me", t => {
    t.skip();
  });
});

You can also add it to mocha.opts which would be picked by CLI:

test/mocha.opts

-r mocha-context/register

$ mocha
describe("my test", () => {
  it("skip me", t => {
    t.skip();
  });
});

Similar projects

Changelog

  • 0.1.5 (May 24, 2018)

    • Fix: lib is not included in the dist.
  • 0.1.4 (May 24, 2018)

    • Fix: reference error when global doesn’t exist.
  • 0.1.3 (May 24, 2018)

    • Fix: support xxx.only, xxx.skip.
    • Fix: hooks (before, beforeEach, etc) have different signature.
  • 0.1.2 (May 23, 2018)

    • Fix: register hook doesn’t work with multiple test files.
  • 0.1.1 (May 23, 2018)

    • Fix: register hook.
  • 0.1.0 (May 22, 2018)

    • First release.

本站文章除注明转载外,均为本站原创或编译。欢迎任何形式的转载,但请务必注明出处。

转载请注明:文章转载自 JavaScript中文网 [https://www.javascriptcn.com]

本文地址:https://www.javascriptcn.com/read-79693.html

文章标题:mocha-context

回到顶部