admin管理员组

文章数量:1356735

After updating to the latest version of Aurelia (March update beta.1.1.4), I'm getting the following error every time I run karma tests:

Error: Reflect.getOwnMetadata is not a function
Error loading C:/Software/myproject/test/unit/myclass.spec.ts

How do I fix it?

After updating to the latest version of Aurelia (March update beta.1.1.4), I'm getting the following error every time I run karma tests:

Error: Reflect.getOwnMetadata is not a function
Error loading C:/Software/myproject/test/unit/myclass.spec.ts

How do I fix it?

Share Improve this question edited Mar 3, 2016 at 19:16 Mikhail Shilkov asked Mar 3, 2016 at 14:42 Mikhail ShilkovMikhail Shilkov 35.2k4 gold badges76 silver badges110 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 12

This has to do with the change of Aurelia from core-js to home-grown polyfills. The Reflect polyfill is missing and tests fail to run.

This problem is addressed in Aurelia navigation skeleton app by the following import statement in each unit test file:

import 'aurelia-polyfills';

I solved it by creating a setup.ts (or setup.js resp. to your language) file with just this statement, and then just listing it in karma.config.js at the first place.

for JS e.g.:

jspm  : {
  loadFiles: ['test/unit/setup.js', 'test/unit/**/*.js'],
  ...
}

for Typescript e.g.:

files: ['test/unit/setup.ts', 'test/unit/**/*.ts'],
...

本文标签: javascriptReflectgetOwnMetadata is not a function in karma with latest AureliaStack Overflow