aurelia/polyfills

Karma getting stuck on aurelia-polyfills import with TS 2.3+

Closed this issue · 1 comments

I'm submitting a bug report

  • Library Version:
    1.2.2

Please tell us about your environment:

  • Operating System:
    Windows 10

  • Node Version:
    6.11.2

  • NPM Version:
    4.6.1
  • JSPM OR Webpack AND Version
    JSPM 0.16.53
  • Browser:
    Chrome 63, PhantomJS 2.1

  • Language:
    TypeScript 2.3 and newer

Current behavior:
When aurelia-polyfills is imported and TypeScript version is at least 2.3.0, Karma will infinitely get stuck before first test.
Minimal example: https://github.com/gronostajo/aurelia-polyfills-bug

Expected/desired behavior:

Tests should run and complete, as with TS 2.2 or without `aurelia-polyfills`.

I was to eager to blame aurelia-polyfills. Beginning with TS2.3, System.JS is detecting typescript.js as an ES module (this regex matches because the string ; export const is present in typescript.js) and attempts to transpile it. To make it work up to TS2.6, one must explicitly specify module format and exports in Karma config:

systemjs: {
  meta: {
    "typescript": {
      format: 'global',
      exports: 'ts',
    }
  },
},