mocha-context

Pass thiscontext as the first argument of the arrow function.

mocha-context

Pass thiscontext 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 --requirethe 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.optswhich 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: libis not included in the dist.
  • 0.1.4 (May 24, 2018)

    • Fix: reference error when globaldoesn'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.

Repository

eight04/mocha-context


上一篇:rollup-plugin-cjs-es
下一篇:ng-packagr-bkn

相关推荐

官方社区

扫码加入 JavaScript 社区