https://github.com/osisdie/mocha-http-test-template
A simple, workable, configable UnitTests using mocha, nconf and axios
https://github.com/osisdie/mocha-http-test-template
axios http integration-testing mocha nodejs starter template testing
Last synced: 2 days ago
JSON representation
A simple, workable, configable UnitTests using mocha, nconf and axios
- Host: GitHub
- URL: https://github.com/osisdie/mocha-http-test-template
- Owner: osisdie
- License: mit
- Created: 2019-06-28T03:28:37.000Z (almost 7 years ago)
- Default Branch: main
- Last Pushed: 2026-03-23T12:28:39.000Z (3 months ago)
- Last Synced: 2026-03-24T09:58:36.956Z (3 months ago)
- Topics: axios, http, integration-testing, mocha, nodejs, starter, template, testing
- Language: JavaScript
- Size: 82 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mocha-http-test-template
[](https://github.com/osisdie/mocha-http-test-template/actions/workflows/ci.yml)
[](LICENSE)
[](https://nodejs.org/)
Minimal Mocha + Axios template for JSON-driven HTTP endpoint testing. Define your endpoints in a config file, and a single `forEach` loop runs the entire test scenario.
*series of code_for_fun*
## Requirements
- Node.js >= 14
## Quick Start
```sh
# Clone the repository
git clone https://github.com/osisdie/mocha-http-test-template.git
cd mocha-http-test-template
# Install dependencies
npm install
# Run tests
npm test
```
## Configuration
Edit `conf/config.json` to define the endpoints you want to test.
Each host group contains an array of request objects:
```json
{
"url": "https://httpbin.org/get",
"method": "GET",
"body": null,
"headers": {}
}
```
Groups named `example` are automatically skipped during test runs.
## Project Structure
```
.
├── app.js # Entry point (prints startup message)
├── conf/
│ └── config.json # Endpoint definitions
├── lib/
│ └── util.js # HTTP request helper & utilities
├── test/
│ └── http_test.js # Mocha test suite
└── package.json
```
## License
[MIT](LICENSE)