最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Reflect.getOwnMetadata is not a function in karma with latest Aurelia - Stack Overflow

programmeradmin1浏览0评论

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'],
...
发布评论

评论列表(0)

  1. 暂无评论