Examples of basic tests using Mocha and Chai, before and after methods, extraction of tests with common before and after methods, Chai plugins.
In this repository you can find examples:
- How to write tests using
return
or async/await. - Usage of
before()
,beforeEach()
,after()
,afterEach()
. - How to group tests and extract common precondition and postcondition methods for tests.
- Plugins for Mocha: mocha-things and mocha-as-promised.
To download depenedcies for the project execute npm install
.
There are four commands to run different types of examples (tests):
test:architecture
test:basic
test:beforeAndAfter
test:mochaPlugins
.
To run any command execute npm run xxx
where instead of "xxx" insert any command from listed above.