# metallicize

> Simple test runner for tRPC.

Latest version **0.0.3** (published 2023-02-03) · 0 weekly downloads

## Install

```sh
npm install metallicize
pnpm add metallicize
yarn add metallicize
bun add metallicize
```

Provides the command `metallicize`.

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2023-02-03 |
| First published | 2023-01-30 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 64 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Matthew Daly |
| Maintainers | matthewd673 |
| Keywords | trpc, test |

## Links

- npm: https://www.npmjs.com/package/metallicize
- Repository: https://github.com/matthewd673/metallicize
- Homepage: https://github.com/matthewd673/metallicize#readme
- Issues: https://github.com/matthewd673/metallicize/issues
- npm.io page: https://npm.io/package/metallicize

## Dependencies (2)

- [chalk](https://npm.io/package/chalk.md) ^4.1.2
- [commander](https://npm.io/package/commander.md) ^10.0.0

## Alternatives

- [duck](https://npm.io/package/duck.md) — 4.2M weekly downloads
- [ava](https://npm.io/package/ava.md) — 560.2K weekly downloads
- [storybook-addon-module-mock](https://npm.io/package/storybook-addon-module-mock.md) — 71.7K weekly downloads
- [@ethereum-waffle/mock-contract](https://npm.io/package/@ethereum-waffle/mock-contract.md) — 40.0K weekly downloads
- [aws-elasticsearch-connector](https://npm.io/package/aws-elasticsearch-connector.md) — 37.4K weekly downloads

## Recent versions

- 0.0.3 (latest) — 2023-02-03
- 0.0.2 — 2023-01-31
- 0.0.1 — 2023-01-30

## README

# metallicize

Simple test runner for tRPC.

```
npm i metallicize -g
metallicize test sequence.json
```

## Build
```
npm run build
npm i -g
metallicize test <test-sequence-file> [output-csv-file]
```

## Options
### `metallicize test`
|Option|Description|
|---|---
|`-p --print <properties...>`|Print additional information about each test. **Values:** `url`, `headers`, `data`.
|`-r --run <names...>`|Run only the specified tests in the sequence.
|`-t --time`|Print the duration of each test's web request. Time data is always recorded and always included in CSV output.

## Syntax
### Sequences
A sequence is a series of tests which are executed in order.

|Key|Description|
|---|---
|`name:string`|The name of the sequence
|`url:string`|The URL of a tRPC API
|`vars:any\|string`|An object with variable names (keys) and values, or a path to a JSON file. Variables can be used in `input` or `data` objects (e.g.: `"text": "{{ name }}"`).
|`tests:test[]`|A list of tests

### Tests
Tests consist of a single query, mutation, or batch to a tRPC route, as well as a success state.

|Key|Description|
|---|---
|`name:string`|The name of the test
|`query?:query`|A tRPC query
|`mutation?:mutation`|A tRPC mutation
|`queries?:query[]`|A batch of tRPC queries
|`mutations?:mutation[]`|A batch of tRPC mutations
|`success:success`|The tests' success state

*Note: each test must include exactly one `query`, `mutation`, `queries`, or `mutations`.*

### Query/Mutation
Queries and mutations define tRPC API calls and work like `useQuery()` and `useMutation()`. They have the same structure but are distinct internally.

|Key|Description|
|---|---
|`route:string`|A public tRPC query or mutation route
|`input:any\|string`|An object to be passed as input to the route, or a path to a JSON file

Queries and mutations can also be batched together by defining them in a list using `tests.queries` or `tests.mutations`.

*Note: all API calls are automatically batched internally for compatibility with `create-t3-app`'s `AppRouter` settings.*

### Success
Success states define the conditions that must be met for a test to pass. Any number of conditions may be included, and they must all match exactly.

|Key|Description|
|---|---
`status?:number`|The HTTP status code
`code?:string`|The `TRPCError` code (e.g.: `NOT_FOUND`)
`errorMessage?:string`|The custom message attached to a `TRPCError`
`dataStrict?:boolean`|When `true`, `data` must match the response object *exactly* to pass. Otherwise, only the keys specified in `data` must match.
`data?:any\|string`|The JSON object expected for a successful request, or a path to a JSON file
`headers?:any`|The response headers. Any headers specified within must match exactly.

*Note: if every field is omitted, the test will always pass.*

---
_Source: https://npm.io/package/metallicize · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
