@testdeck/di-typedi

v0.0.3
testdeck-mocha dependency injection support for typedi

Get it on NPM License Build Status Coverage Quality Gate Status Issues Pull Requests

@testdeck/di-typedi

Integration of the TypeDI IOC.

import { suite, test } from "@testdeck/mocha";
import { expect } from "chai";

// register TypeDI support with testdeck and also let reflect-metadata do it's magic
import "@testdeck/di-typedi";
import "reflect-metadata";

import { Service } from "typedi";

@Service()
class SomeService {

  doSomething(): boolean {

    return false;
  }
}

@suite
class Hello {

  constructor(private service: SomeService) {
  }

  @test
  world() {
    expect(this.service.doSomething()).to.be.true;
  }
}

This also works with the provided integrations for Jasmine and Jest.

If you are looking for other test framework support, please see the following packages

Installation

npm install --save-dev typedi reflect-metadata @testdeck/di-typedi

Additional Information

You can find a lot more information in the official documentation.

Read more about TypeDI.

npm i @testdeck/[email protected]

Metadata

Downloads