-
Notifications
You must be signed in to change notification settings - Fork 185
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add shared registry for use when multiple versions are loaded
- Loading branch information
Showing
10 changed files
with
1,011 additions
and
241 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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,13 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es5", | ||
"noImplicitAny": true, | ||
"sourceMap": true, | ||
"module": "commonjs", | ||
"types": ["node", "mocha"], | ||
"typeRoots": ["../../node_modules/@types"], | ||
}, | ||
"include": [ | ||
"**/*.ts" | ||
] | ||
} |
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,13 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es5", | ||
"noImplicitAny": true, | ||
"sourceMap": true, | ||
"module": "commonjs", | ||
"types": ["node", "mocha"], | ||
"typeRoots": ["../../node_modules/@types"], | ||
}, | ||
"include": [ | ||
"**/*.ts" | ||
] | ||
} |
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,31 @@ | ||
/// <reference path="../../index.d.ts" /> | ||
/// <reference path="../../globals.d.ts" /> | ||
const ReflectNoConflict = require("../../ReflectNoConflict"); | ||
require("../../Reflect"); | ||
import { assert } from "chai"; | ||
|
||
describe("MetadataRegistry", () => { | ||
it("defines registry", () => { | ||
const registrySymbol = Symbol.for("@reflect-metadata:registry"); | ||
const registry = (Reflect as any)[registrySymbol] as MetadataRegistry; | ||
assert.isDefined(registry); | ||
}); | ||
it("two registries", () => { | ||
const registrySymbol = Symbol.for("@reflect-metadata:registry"); | ||
const registry = (Reflect as any)[registrySymbol] as MetadataRegistry; | ||
const obj1 = {}; | ||
ReflectNoConflict.defineMetadata("key", "value", obj1); | ||
const obj2 = {}; | ||
Reflect.defineMetadata("key", "value", obj2); | ||
const provider1 = registry.getProvider(obj1, undefined); | ||
const provider2 = registry.getProvider(obj2, undefined); | ||
assert.isDefined(provider1); | ||
assert.isDefined(provider2); | ||
assert.notStrictEqual(provider1, provider2); | ||
}); | ||
it("registries are shared", () => { | ||
const obj = {}; | ||
ReflectNoConflict.defineMetadata("key", "value", obj); | ||
assert.isTrue(Reflect.hasOwnMetadata("key", obj)); | ||
}); | ||
}); |
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,13 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es5", | ||
"noImplicitAny": true, | ||
"sourceMap": true, | ||
"module": "commonjs", | ||
"types": ["node", "mocha"], | ||
"typeRoots": ["../../node_modules/@types"], | ||
}, | ||
"include": [ | ||
"**/*.ts" | ||
] | ||
} |