Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/h3ar7b3a7/mochatesting
TDD example with Mocha and Chai.
https://github.com/h3ar7b3a7/mochatesting
chai mocha tdd
Last synced: 7 days ago
JSON representation
TDD example with Mocha and Chai.
- Host: GitHub
- URL: https://github.com/h3ar7b3a7/mochatesting
- Owner: H3AR7B3A7
- Created: 2021-01-21T23:09:40.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2021-01-22T19:46:54.000Z (about 4 years ago)
- Last Synced: 2025-01-15T04:30:52.391Z (18 days ago)
- Topics: chai, mocha, tdd
- Language: JavaScript
- Homepage:
- Size: 5.86 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Mocha Testing
[Official Web Pages](https://mochajs.org/)
Mocha is a feature-rich JavaScript test framework running on Node.js and in the browser, making asynchronous testing simple and fun. Mocha tests run serially, allowing for flexible and accurate reporting, while mapping uncaught exceptions to the correct test cases.### Create Project
Navigate to the desired directory, and:
>npm init
>npm install --save-dev mocha chaiCreate a 'test' folder and edit *package.json* to use Mocha:
"scripts": {
"test": "mocha"
}## Running Tests
>mocha test
>npm test
>mocha --reporter min
>mocha --reporter markdown
>mocha --reporter nyanOr we can automate running the test on saving the file:
>mocha --watch ./test/ship_test.js ./game_logic/game_methods.jsOr edit *package.json*:
"scripts": {
"test": "mocha"
"test:watch": "mocha --watch ./test ./"
}To have Mocha watch all files:
>mocha:watchTo stop Mocha from watching:
>Ctrl + C