From 1341a7bb9cc14ecd0a1755cd2de1c09384a431c6 Mon Sep 17 00:00:00 2001 From: Maxim Filippov Date: Thu, 13 Dec 2018 20:27:03 +0300 Subject: [PATCH] Use babel polyfill in karma --- package.json | 1 + .../user_profile_link_generator.js | 2 +- test/unit/karma.conf.js | 5 ++++- yarn.lock | 15 ++++++++++++++- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 8f2a78a2..3a2ab212 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "whatwg-fetch": "^2.0.3" }, "devDependencies": { + "@babel/polyfill": "^7.0.0", "@vue/test-utils": "^1.0.0-beta.26", "autoprefixer": "^6.4.0", "babel-core": "^6.0.0", diff --git a/src/services/user_profile_link_generator/user_profile_link_generator.js b/src/services/user_profile_link_generator/user_profile_link_generator.js index 3e245b15..9ae15792 100644 --- a/src/services/user_profile_link_generator/user_profile_link_generator.js +++ b/src/services/user_profile_link_generator/user_profile_link_generator.js @@ -5,6 +5,6 @@ const generateProfileLink = (id, screenName) => { } } -const isExternal = screenName => (screenName.indexOf('@') > -1) +const isExternal = screenName => screenName.includes('@') export default generateProfileLink diff --git a/test/unit/karma.conf.js b/test/unit/karma.conf.js index 89f21b2e..d19a2229 100644 --- a/test/unit/karma.conf.js +++ b/test/unit/karma.conf.js @@ -56,7 +56,10 @@ module.exports = function (config) { browsers: ['PhantomJS'], frameworks: ['mocha', 'sinon-chai'], reporters: ['mocha'], - files: ['./index.js'], + files: [ + '../../node_modules/@babel/polyfill/dist/polyfill.js', + './index.js' + ], preprocessors: { './index.js': ['webpack', 'sourcemap'] }, diff --git a/yarn.lock b/yarn.lock index 832900fc..e0e98ed7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9,6 +9,14 @@ dependencies: "@babel/types" "^7.0.0" +"@babel/polyfill@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/polyfill/-/polyfill-7.0.0.tgz#c8ff65c9ec3be6a1ba10113ebd40e8750fb90bff" + integrity sha512-dnrMRkyyr74CRelJwvgnnSUDh2ge2NCTyHVwpOdvRMHtJUyxLtMAfhBN3s64pY41zdw0kgiLPh6S20eb1NcX6Q== + dependencies: + core-js "^2.5.7" + regenerator-runtime "^0.11.1" + "@babel/types@^7.0.0", "@babel/types@^7.0.0-beta.49": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.2.0.tgz#7941c5b2d8060e06f9601d6be7c223eef906d5d8" @@ -1583,7 +1591,7 @@ cookie@0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.3.1.tgz#e7e0a1f9ef43b4c8ba925c5c5a96e806d16873bb" -core-js@^2.2.0: +core-js@^2.2.0, core-js@^2.5.7: version "2.6.0" resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.0.tgz#1e30793e9ee5782b307e37ffa22da0eacddd84d4" integrity sha512-kLRC6ncVpuEW/1kwrOXYX6KQASCVtrh1gQr/UiaVgFlf9WE5Vp+lNe5+h3LuMr5PAucWnnEXwH0nQHRH/gpGtw== @@ -5510,6 +5518,11 @@ regenerator-runtime@^0.11.0: version "0.11.0" resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.0.tgz#7e54fe5b5ccd5d6624ea6255c3473be090b802e1" +regenerator-runtime@^0.11.1: + version "0.11.1" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9" + integrity sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg== + regenerator-transform@^0.10.0: version "0.10.1" resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.10.1.tgz#1e4996837231da8b7f3cf4114d71b5691a0680dd"