reflection icon indicating copy to clipboard operation
reflection copied to clipboard

Setup tests with several frameworks

Open abraham opened this issue 6 years ago • 2 comments

Add an examples directory with a simple app of each of the following frameworks/libraries. The samples should make use of Reflection and have their tests run on CI. This will provide examples for developers of those libraries and make sure Reflection doesn't break compatibility. Lerna might be a good choice to manage the examples.

  • https://github.com/inversify/InversifyJS
  • https://github.com/angular/angular
  • https://github.com/Polymer/lit-element
  • https://github.com/abraham/nutmeg

abraham avatar Jan 04 '19 00:01 abraham

Doesn't work with InversifyJS

import "@abraham/reflection";
import { Container, injectable } from "inversify";

const myContainer = new Container();

const TYPES = {
  Ninja: Symbol("Ninja")
};

@injectable()
class Ninja {}

myContainer.bind<Ninja>(TYPES.Ninja).to(Ninja);

const ninja = myContainer.get<Ninja>(TYPES.Ninja);

Error:

Uncaught TypeError: Reflect.hasMetadata is not a function
    at _postConstruct (instantiation.js:24)
    at Object.resolveInstance (instantiation.js:47)
    at resolver.js:72
    at Object.resolve (resolver.js:96)
    at container.js:319
    at Container../node_modules/inversify/lib/container/container.js.Container._get (container.js:310)
    at Container../node_modules/inversify/lib/container/container.js.Container.get (container.js:230)
    at Object../src/inversifytest.ts (inversifytest.ts:15)
    at __webpack_require__ (bootstrap ee47681dc696ba0b4a90:678)
    at fn (bootstrap ee47681dc696ba0b4a90:88)
    at Object../src/index.tsx (index.tsx:1)
    at __webpack_require__ (bootstrap ee47681dc696ba0b4a90:678)
    at fn (bootstrap ee47681dc696ba0b4a90:88)
    at Object.0 (inversifytest.ts:15)
    at __webpack_require__ (bootstrap ee47681dc696ba0b4a90:678)
    at bootstrap ee47681dc696ba0b4a90:724
    at bootstrap ee47681dc696ba0b4a90:724

I tested it within webpack but error is pretty clear. @abraham/reflection doesn't define Reflect.hasMetadata.

elderapo avatar Feb 15 '19 15:02 elderapo

@elderapo please create a new issue for that. This feature request is for tracking adding additional framework tests.

abraham avatar Feb 15 '19 17:02 abraham