diff --git a/karma-js.conf.js b/karma-js.conf.js index 8549550b83..e8b1bf51bd 100644 --- a/karma-js.conf.js +++ b/karma-js.conf.js @@ -24,7 +24,8 @@ module.exports = function(config) { 'node_modules/reflect-metadata/Reflect.js', 'tools/build/file2modulename.js', 'test-main.js', - {pattern: 'modules/**/test/**/static_assets/**', included: false, watched: false} + {pattern: 'modules/**/test/**/static_assets/**', included: false, watched: false}, + 'modules/angular2/src/test_lib/shims_for_IE.es6' ], exclude: [ diff --git a/modules/angular2/src/test_lib/shims_for_IE.es6 b/modules/angular2/src/test_lib/shims_for_IE.es6 new file mode 100644 index 0000000000..94117011ff --- /dev/null +++ b/modules/angular2/src/test_lib/shims_for_IE.es6 @@ -0,0 +1,13 @@ +//function.name +/*! @source http://stackoverflow.com/questions/6903762/function-name-not-supported-in-ie*/ +if (!(function f() {}).name) { + Object.defineProperty(Function.prototype, 'name', { + get: function() { + var name = this.toString().match(/^\s*function\s*(\S*)\s*\(/)[1]; + // For better performance only parse once, and then cache the + // result through a new accessor for repeated access. + Object.defineProperty(this, 'name', { value: name }); + return name; + } + }); +}