eykrehbein / strest

⚡️ CI-ready tests for REST APIs configured in YAML
MIT License
1.74k stars 59 forks source link

add module export to allow other services to consume results of test runs #136

Open larrybotha opened 5 years ago

larrybotha commented 5 years ago

It'd be great to be able to consume the results of tests, as Postman's Newman CLI tool allows.

Jest allows for custom test runners to be configured; one doesn't need to use Jest's methods to run tests, but one can still benefit from Jest's other features.

e.g. there is a Mocha runner for Jest, as well as an ESLint runner.

By allowing for a custom Jest runner to consume results of tests we get the following from Jest:

Describe the solution you'd like

A module that passes the results of a test run to a callback.

Example:

// my-api-endpoint-1.test.js
const strest = require('strest')

const strestConfig = {
    // references to yaml files and configs for this test
};

strest.run(strestConfig, (err, result) => {
    // handle err / result of test run
});

Additional context

For reference on what can be done with Jest...

Jest Mocha runner: Gif of jest-runner-mocha


Watch typeahead: Gif of jest-watch-typeahead


Watch select projects: Gif of jest-watch-select-projects