cargotest
A typescript testing framework using decorators.
Last updated a year ago by victorzki .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install cargotest 
SYNC missed versions from official npm registry.

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

"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.

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

Current Tags

  • 0.0.24                                ...           latest (a year ago)

22 Versions

  • 0.0.24                                ...           a year ago
  • 0.0.23                                ...           a year ago
  • 0.0.22                                ...           a year ago
  • 0.0.21                                ...           a year ago
  • 0.0.20                                ...           a year ago
  • 0.0.19                                ...           a year ago
  • 0.0.18                                ...           a year ago
  • 0.0.17                                ...           a year ago
  • 0.0.15                                ...           a year ago
  • 0.0.14                                ...           a year ago
  • 0.0.13                                ...           a year ago
  • 0.0.12                                ...           a year ago
  • 0.0.11                                ...           a year ago
  • 0.0.10                                ...           a year ago
  • 0.0.8                                ...           a year ago
  • 0.0.7                                ...           a year ago
  • 0.0.6                                ...           a year ago
  • 0.0.5                                ...           a year ago
  • 0.0.4                                ...           a year ago
  • 0.0.3                                ...           a year ago
  • 0.0.2                                ...           a year ago
  • 0.0.1                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 1
This Month 1
Last Day 1
Last Week 0
Last Month 24
Dependencies (14)
Dev Dependencies (1)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |