@hyperfrontend/workspace/executors/testtest
Runs a project's suites on Node's built-in test runner through @hyperfrontend/testing: it starts a Node process with the runtime's preload, loads the project's test configuration, prints the coverage table and the reasons a run failed.
{
"test": {
"executor": "@hyperfrontend/workspace:test"
}
}
| Option | What it does |
|---|---|
--testConfig | The test configuration; defaults to test.config.ts in the project |
--coverageDirectory | Where coverage is written; defaults to coverage/<project root> under the root |
The runtime is resolved from the workspace that runs the task.
API Reference§
ƒ Functions
Loads a project's test configuration and runs its suites.
Parameters
| Name | Type | Description |
|---|---|---|
§argv | unknown | The workspace root, the project root, the coverage directory and the configuration module |
Returns
Promise< number>The exit code: 0 when every suite passed and the coverage thresholds held, 1 otherwise
§functiontestExecutor(
testExecutor( options: TestExecutorOptions, context: ExecutorContext): Promise< ExecutorResult>
Test executor for workspace projects.
Runs the project's suites on Node's built-in test runner. The runner is started as its own process so the project's
Runs the project's suites on Node's built-in test runner. The runner is started as its own process so the project's
test.config.ts is evaluated by the same runtime that executes the tests, rather than by whatever TypeScript loader the calling process has installed.Parameters
| Name | Type | Description |
|---|---|---|
§options | TestExecutorOptions | Executor options naming the test configuration and coverage directory |
§context | ExecutorContext | The workspace, the project and the target the task runs on |
Returns
Promise< ExecutorResult>An object indicating success or failure of the test run
Example
A `test` target reading the project's `test.config.ts`
{
"targets": {
"test": {
"executor": "@hyperfrontend/workspace:test",
"options": { "coverageDirectory": "coverage/libs/core" }
}
}
}
```
`npx hf run lib-core:test` starts a Node.js process with `@hyperfrontend/testing/hooks` preloaded; coverage lands in `coverage/libs/core`, the default for a project at `libs/core`.◈ Interfaces
Schema types for the test executor.
Properties
● Variables
The entry of this package that holds the runner the executor starts in a process of its own.