jayphelps / core-decorators

Library of stage-0 JavaScript decorators (aka ES2016/ES7 decorators but not accurate) inspired by languages that come with built-ins like @​override, @​deprecate, @​autobind, @​mixin and more. Popular with React/Angular, but is framework agnostic.
MIT License
4.52k stars 263 forks source link

Puzzling code in unit tests #119

Closed BurtHarris closed 7 years ago

BurtHarris commented 7 years ago

I'm trying to run unit tests w/ TypeScript as the transpiler. Got some errors where I don't understand the code, like this from test/unit/extendDescriptor.js

  it('extends property initializers', function () {
    Object.getOwnPropertyDescriptor(Derived.prototype, 'fourth');
      .enumerable.should.equal(false);   // *** ERROR HERE ***

    derived.fourth.should.equal('fourth');
  });

What's the .enumerable mean when there's a ; before it?

C:\code\core-decorators.js\test>tsc
unit/extendDescriptor.js(82,7): error TS1128: Declaration or statement expected.
unit/extendDescriptor.js(89,7): error TS1128: Declaration or statement expected.
unit/mixin.spec.js(22,10): error TS1109: Expression expected.
unit/mixin.spec.js(37,17): error TS1109: Expression expected.
BurtHarris commented 7 years ago

Found a workaround...

jayphelps commented 7 years ago

@BurtHarris not sure why you're seeing a semicolon there? It's not in the source https://github.com/jayphelps/core-decorators.js/blob/master/test/unit/enumerable.spec.js#L10

It would indeed be an error, if one was inserted somehow.