This repository was archived by the owner on Aug 19, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
RFC #1 - test entry point #20
Open
lawnsea
wants to merge
1
commit into
RetailMeNotSandbox:master
Choose a base branch
from
lawnsea:rfc-testing-entry-point
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Its not clear to me what the test would do differently in a case where the server is running vs. where it is not? I'm still on board with the server being running being optional, however if a test.js bypasses an entire subset of its test suite because the server is not running, I would not be particularly comfortable with the test.js file exiting 0 in this case, as it is not fully confident that the ingredient passes all of its test. |
||
| 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. | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this needs to be fleshed out a bit further. If I am invoking tests for multiple ingredients from the command line, will all arguments passed to process.argv be passed to all the ingredients? What if two ingredients allow for the same flags but interpret them to mean different things?
Random thought that is probably a bad idea: Perhaps using a tool like commander to roll up, parse, and generate a help message for the options allowed by each ingredient being run for this invocation of the test runner would be in order? That would give us a chance to prevent two ingredients from expecting the same flag with a different meaning.