Summary
Problem
We want ingredients and pantries to be easy to test. Specifically, it should be easy to write both unit and functional tests, easy to run those tests, and easy to obtain coverage data.
This RFC proposes the ingredient interface to support these goals.
Solution Overview
Ingredients may define a test entry point (test.js) that runs the ingredient's unit and functional tests and reports TAP results. The test harness will ensure a Roux server is running before executing the test entry point. It will provide the URL for that server as well as any other configuration information via environment variables. The test harness will be able to execute the test entry points of multiple ingredients and report the aggregate results.
API
Test entry point
An ingredient MAY define a test entry point by including a file named test.js in the ingredient root. If present, the script MUST report its result by printing a Test Anything Protocol (TAP) test stream to stdout.
A test entry point MAY assume that a Roux server is running and WILL receive the root URL for its ingredient as an environment variable named ROUX_INGREDIENT_URL.
A test entry point MUST NOT assume that it is the only test entry point executing. The test runner MAY execute multiple entry points concurrently, so access to any shared resources MUST be coordinated via other means.