jayphelps/core-decorators

Puzzling code in unit tests

Closed this issue · 2 comments

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.

Found a workaround...

@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.