Skip to content

Commit

Permalink
RFC RetailMeNotSandbox#1 - test entry point
Browse files Browse the repository at this point in the history
The RFC proposes we specify the behavior of a test entry point.

[Fix RetailMeNotSandbox#6]
  • Loading branch information
lawnsea committed Nov 16, 2016
1 parent 2e37faf commit baefa57
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions doc/rfc/1-test-entry-point.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# 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](https://testanything.org/) results.
The test harness can be configured to ensure a Roux server is running before
executing the test entry point. If it does so, it will provide the URL for that
server via an environment variable.
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. When invoked, the script must print a [Test Anything
Protocol (TAP)](https://testanything.org/) test stream to `stdout` before
exiting. The script MAY run one or more tests when invoked. The result of any
tests the script runs MUST be printed to the TAP stream. If any test fails, the
script MUST exit with a non-zero exit code. Otherwise, it MUST exit with an exit
code of zero.

The test entry point MAY receive configuration via its `process.argv` and
`process.env` properties.

The test entry point MUST NOT assume a Roux server is running. If a Roux server
is running, the test entry point 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 harness MAY execute multiple entry points concurrently, so
access to any shared resources MUST be coordinated via other means.

0 comments on commit baefa57

Please sign in to comment.