# cargotest

> A typescript testing framework using decorators.

Latest version **0.0.24** (published 2018-11-21) · MIT license · 0 weekly downloads

## Install

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

Provides the command `cargo`.

## Health

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

Positive: has types; no vulnerabilities; high quality score.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.24 |
| Published | 2018-11-21 |
| First published | 2018-11-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 14 |
| Unpacked size | 32.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Victor Alveflo |
| Maintainers | victorzki |
| Keywords | typescript, testing, unit, test |

## Links

- npm: https://www.npmjs.com/package/cargotest
- Repository: https://github.com/alveflo/ts-unit
- Homepage: https://github.com/alveflo/ts-unit#readme
- Issues: https://github.com/alveflo/ts-unit/issues
- npm.io page: https://npm.io/package/cargotest

## Dependencies (14)

- [exit](https://npm.io/package/exit.md) ^0.1.2
- [sync](https://npm.io/package/sync.md) ^0.2.5
- [colors](https://npm.io/package/colors.md) ^1.3.2
- [tslint](https://npm.io/package/tslint.md) ^5.11.0
- [ts-node](https://npm.io/package/ts-node.md) ^7.0.1
- [typescript](https://npm.io/package/typescript.md) ^3.1.6
- [@types/chai](https://npm.io/package/@types/chai.md) ^4.1.7
- [@types/exit](https://npm.io/package/@types/exit.md) ^0.1.30
- [@types/node](https://npm.io/package/@types/node.md) ^10.12.3
- [log-symbols](https://npm.io/package/log-symbols.md) ^2.2.0
- [commander-ts](https://npm.io/package/commander-ts.md) ^0.1.5
- [write-json-file](https://npm.io/package/write-json-file.md) ^3.0.2
- [reflect-metadata](https://npm.io/package/reflect-metadata.md) ^0.1.12
- [@types/log-symbols](https://npm.io/package/@types/log-symbols.md) ^2.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
- [vest](https://npm.io/package/vest.md) — 50.1K weekly downloads
- [@ethereum-waffle/mock-contract](https://npm.io/package/@ethereum-waffle/mock-contract.md) — 40.0K weekly downloads

## Recent versions

- 0.0.24 (latest) — 2018-11-21
- 0.0.23 — 2018-11-21
- 0.0.22 — 2018-11-16
- 0.0.21 — 2018-11-15
- 0.0.20 — 2018-11-15
- 0.0.19 — 2018-11-15
- 0.0.18 — 2018-11-15
- 0.0.17 — 2018-11-15
- 0.0.15 — 2018-11-15
- 0.0.14 — 2018-11-15
- 0.0.13 — 2018-11-14
- 0.0.12 — 2018-11-14
- 0.0.11 — 2018-11-14
- 0.0.10 — 2018-11-14
- 0.0.8 — 2018-11-14
- … 7 more at https://npm.io/package/cargotest/versions

## README

# Cargotest
An experimental, yet functional, chai testing framework to encourage a more NUnit-ish approach to testing in typescript.

## Install
```
$ npm install -D cargotest
```
### Global runner
```
$ npm install -g cargotest
```

## Setup
`experimentalDecorators` and `emitDecoratorMetadata` needs to be set to true.

## Usage
### Runner
The runner is used either by invoking the cli application (`$ cargo`) and the runner will run all tests in `./tests` folder (if `--path` is not provided to cargo cli application).

### Test script setup
Package.json
```json
"scripts": {
    "test": "./node_modules/.bin/cargo"
}
```

### Code usage
Cargotest currently supports `Test` and `TestCase` decorators, as shown below. The decorators is only used to evaluate the corresponding function and that's it. For assertions, use chai.
```typescript
import { assert } from "chai";
class TestClass {
    @Test
    public When_something_Then_something() {
        let foo = new Foo();

        assert.equal(foo.Bar(), "Bar");
    }

    @Testcase("Darth", "Vader")
    @Testcase("Obi wan", "Kenobi")
    public When_something_Then_something_else(firstName: string, lastName: string) {
        let bar = new Bar();

        assert.equal(bar.GetLastName(firstName), lastName);
    }
}
```

# License
MIT

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