Add Test
Scaffold a new .test.ts in the nearest tests/ folder so it runs with the test workflow.
Purpose
- Create a test quickly in the right location.
- Keep tests organized alongside the code under test.
When To Use
- Adding coverage for a feature, workflow, or contract.
CLI
webstir add-test <name-or-path>
Inputs
<name-or-path>: file name or relative path. The workflow resolves the closesttests/folder from the provided context.
Steps
- Resolve target
tests/folder. - Delegate to the
@webstir-io/webstir-testingTypeScript CLI (webstir-testing-add) which writes the template if it does not already exist. - Ensure the workspace depends on the configured testing provider (default
@webstir-io/webstir-testing) so the Node test runner can execute—webstir installreconciles dependencies based onwebstir.providers.json.
Outputs
- New test file:
<resolved-tests-folder>/<name>.test.ts.
Errors & Exit Codes
- Non-zero if the path is invalid, the file exists, or file IO fails.