3.3.2 • Published 8 years ago

mai-chai v3.3.2

Weekly downloads
7
License
MIT
Repository
github
Last release
8 years ago

mai-chai

The chai testing framework works hand in hand with mocha. It is configured by default with following plugins:

mai-chai also includes configuration files which will be written into the ./test folder of the including project:

  • mocha.opts registers Babel as the compiler and requires the ./test/test-helper.js file in every test.
  • test-helper.js configures the global document, window and navigator objects.

And for Wallaby.js users, mai-chai comes with a default configuration file.

Conventions

mai-chai follows these conventions:

  • ./src source code under test.
  • ./src.test source code for the tests.
  • ./test mocha configuration files.

Installing mai-chai

First install mai-chai:

npm install mai-chai --save-dev

This will also install mocha, chai, chai-as-promised, chai-asserttype, chai-equal-jsx, chai-spies, chai-string and dirty-chai.

Using mai-chai

Import expect from mai-chai, as you would from chai:

import {expect} from 'mai-chai';

and then write your BDD assertions with methods rather than properties, such as:

expect (true).to.be.true ();
foo.should.be.ok ();

or use the various assertions added by chai-string and spy on methods with chai-spies.

Configuring Wallaby.js

mai-chai provides a default Wallaby.js configuration file. If you stick to the conventions of mai-chai no other setup or configuration is required. Just point Wallaby.js to wallaby.conf.js.

Included plugins

See also Algolia's react-element-to-jsx-string which is used by chai-equal-jsx and provides the logic needed to convert a ReactElement to the corresponding JSX string.

Utility functions

  • clock() perf, starts a high resolution timer which can be used to measure performance; it returns an opaque object.
  • clock(perf) ms, returns the number of milliseconds elapsed.
3.3.2

8 years ago

3.3.1

8 years ago

3.3.0

8 years ago

3.2.0

8 years ago

3.1.0

9 years ago

3.0.1

9 years ago

3.0.0

9 years ago

2.6.0

9 years ago

2.5.3

9 years ago

2.5.2

9 years ago

2.5.1

9 years ago

2.4.0

9 years ago

2.3.0

9 years ago

2.2.1

9 years ago

2.2.0

9 years ago

2.1.0

9 years ago

2.0.1

9 years ago

2.0.0

9 years ago

1.1.2

10 years ago

1.1.1

10 years ago

1.1.0

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago

0.4.0

10 years ago

0.3.0

10 years ago

0.2.0

10 years ago