-
Notifications
You must be signed in to change notification settings - Fork 719
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fixed #549 * Removed latest version of nodejs in AppVeyor because there is issues in windows sometimes * Update sinon to the latest version * Small improvements
- Loading branch information
1 parent
17400d6
commit aabe43c
Showing
8 changed files
with
117 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,6 @@ environment: | |
NODE_ENV: test | ||
|
||
matrix: | ||
- nodejs_version: "stable" | ||
- nodejs_version: "7.10.1" | ||
|
||
build: off | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import * as ERROR_MSGS from "../constants/error_msgs"; | ||
|
||
export function isStackOverflowExeption(error: Error) { | ||
return ( | ||
error instanceof RangeError || | ||
error.message === ERROR_MSGS.STACK_OVERFLOW | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { expect } from "chai"; | ||
import { Container, injectable, inject } from "../../src/inversify"; | ||
import * as ERROR_MSGS from "../../src/constants/error_msgs"; | ||
|
||
describe("issue 549", () => { | ||
|
||
it("Should throw if circular dependencies found with dynamics", () => { | ||
|
||
@injectable() | ||
class A { | ||
public b: B; | ||
public constructor( | ||
@inject("B") b: B | ||
) { | ||
this.b = b; | ||
} | ||
} | ||
|
||
@injectable() | ||
class B { | ||
public a: A; | ||
public constructor( | ||
@inject("A") a: A | ||
) { | ||
this.a = a; | ||
} | ||
} | ||
|
||
let container = new Container({defaultScope: "Singleton"}); | ||
container.bind(A).toSelf(); | ||
container.bind(B).toSelf(); | ||
container.bind("A").toDynamicValue(ctx => | ||
ctx.container.get(A) | ||
); | ||
|
||
container.bind("B").toDynamicValue(ctx => | ||
ctx.container.get(B) | ||
); | ||
|
||
function willThrow() { | ||
return container.get<A>("A"); | ||
} | ||
|
||
const expectedError = ERROR_MSGS.CIRCULAR_DEPENDENCY_IN_FACTORY("toDynamicValue", "A"); | ||
expect(willThrow).to.throw(expectedError); | ||
|
||
}); | ||
|
||
}); |