Skip to content

Commit

Permalink
Fixes issue #559
Browse files Browse the repository at this point in the history
* Fixed #559

* Fixed coverage reports

* Test in more modern versions of Node.js

* Rollback chai upgrade
  • Loading branch information
remojansen authored May 30, 2017
1 parent 8f337a4 commit d66c29c
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 11 deletions.
6 changes: 2 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
language: node_js
node_js:
- stable
- 5.4.1
- 7.7.1
- 6.9.5
- 5.4.0
- 5.3.0
- 5.2.0
- 5.1.1
- 4.4.6
before_install:
- npm install -g codeclimate-test-reporter
Expand Down
6 changes: 2 additions & 4 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@ environment:

matrix:
- nodejs_version: "stable"
- nodejs_version: "5.4.1"
- nodejs_version: "7.7.1"
- nodejs_version: "6.9.5"
- nodejs_version: "5.4.0"
- nodejs_version: "5.3.0"
- nodejs_version: "5.2.0"
- nodejs_version: "5.1.1"
- nodejs_version: "4.4.6"

build: off
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "inversify",
"version": "4.1.0",
"version": "4.1.1",
"description": "A powerful and lightweight inversion of control container for JavaScript and Node.js apps powered by TypeScript.",
"main": "lib/inversify.js",
"jsnext:main": "es/inversify.js",
Expand Down Expand Up @@ -46,7 +46,7 @@
"es6-symbol": "^3.1.0",
"gulp": "^3.9.0",
"gulp-istanbul": "^1.0.0",
"gulp-mocha": "4.3.1",
"gulp-mocha": "3.0.1",
"gulp-rename": "^1.2.2",
"gulp-sourcemaps": "^2.2.1",
"gulp-tslint": "^8.0.0",
Expand Down
3 changes: 2 additions & 1 deletion src/planning/reflection_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,8 @@ function getBaseClassDepencencyCount(metadataReader: interfaces.MetadataReader,
if (baseConstructor !== Object) {

// get targets for base class
let baseConstructorName = getFunctionName(func);
let baseConstructorName = getFunctionName(baseConstructor);

let targets = getTargets(metadataReader, baseConstructorName, baseConstructor, true);

// get unmanaged metadata
Expand Down
42 changes: 42 additions & 0 deletions test/bugs/bugs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -807,4 +807,46 @@ describe("Bugs", () => {

});

it("Should detect missing annotations in base classes", () => {

@injectable()
class Katana implements Katana {
public hit() {
return "cut!";
}
}

abstract class Warrior {
private _katana: Katana;

public constructor(
@unmanaged() katana: Katana
) {
this._katana = katana;
}

public fight() {return this._katana.hit(); }
}

@injectable()
class Ninja extends Warrior {
public constructor (
@inject("Katana") katana: Katana
) {
super(katana);
}
}

let container = new Container();
container.bind<Warrior>("Ninja").to(Ninja);
container.bind<Katana>("Katana").to(Katana);

const tryGet = () => {
container.get<Ninja>("Ninja");
};

expect(tryGet).to.throw("Missing required @injectable annotation in: Warrior.");

});

});

0 comments on commit d66c29c

Please sign in to comment.