https://github.com/fixate/jest-runner-newman
A Jest runner for Postman's Newman CLI tool
https://github.com/fixate/jest-runner-newman
Last synced: 3 months ago
JSON representation
A Jest runner for Postman's Newman CLI tool
- Host: GitHub
- URL: https://github.com/fixate/jest-runner-newman
- Owner: fixate
- License: mit
- Created: 2018-12-23T20:46:09.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-01-13T13:30:43.000Z (almost 7 years ago)
- Last Synced: 2025-07-21T12:34:02.731Z (4 months ago)
- Language: JavaScript
- Size: 4.77 MB
- Stars: 12
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Jest Runner Newman
[](https://travis-ci.org/fixate/jest-runner-newman)
[](https://badge.fury.io/js/jest-runner-newman)
A Jest runner for Postman's [Newman](https://github.com/postmanlabs/newman) CLI tool.
**Table of Contents**
- [Purpose](#purpose)
- [Install](#install)
- [Running tests](#running-tests)
- [License](#license)
## Purpose
Easily run automated tests for your Postman collections using Newman and Jest.
## Install
```bash
$ npm install -D jest-runner-newman newman
```
```javascript
# jest.newman.js
module.exports = {
displayName: 'newman',
testMatch: ['/path/to/tests/**.test.js'],
runner: 'jest-runner-newman',
}
```
```bash
npx jest -c jest.newman.js
```
## Running tests
`jest-runner-newman` runs Newman tests in Node child processes. In addition to
running a Newman test via the `newman` module, each test needs to send the
parent process the result of the test run. To make this easier,
`jest-runner-newman` exports a separate module to specifically handle that:
```javascript
# my-collection.test.js
const {handleResult} = require('jest-runner-newman/handle-result')
const newman = require('newman');
module.exports = newman.run({
collection: `[collection-url]`,
environment: `[environment-url]`,
reporters: ['cli'],
// any other newman configs
}, (err, result) => {
handleResult(err, result);
// anything else you want
})
```
## License
MIT