From 85d8ad64aa864f4c0800fbb9a895432b5edfdfe3 Mon Sep 17 00:00:00 2001 From: Evan You Date: Wed, 26 Dec 2018 15:38:52 -0500 Subject: [PATCH] build: use headless chrome by default for unit tests --- package.json | 3 ++- test/unit/karma.cover.config.js | 6 ++++-- test/unit/karma.dev.config.js | 6 ++++-- yarn.lock | 32 +++++++++++++++++++++++++++++--- 4 files changed, 39 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 178785d3..da3d1ae6 100644 --- a/package.json +++ b/package.json @@ -123,6 +123,7 @@ "nightwatch": "^0.9.16", "nightwatch-helpers": "^1.2.0", "phantomjs-prebuilt": "^2.1.14", + "puppeteer": "^1.11.0", "resolve": "^1.3.3", "rollup": "^0.68.1", "rollup-plugin-alias": "^1.3.1", @@ -135,8 +136,8 @@ "selenium-server": "^2.53.1", "serialize-javascript": "^1.3.0", "shelljs": "^0.8.1", - "typescript": "^3.1.3", "terser": "^3.10.2", + "typescript": "^3.1.3", "webpack": "^4.22.0", "weex-js-runtime": "^0.23.6", "weex-styler": "^0.3.0", diff --git a/test/unit/karma.cover.config.js b/test/unit/karma.cover.config.js index e1801548..ee03884e 100644 --- a/test/unit/karma.cover.config.js +++ b/test/unit/karma.cover.config.js @@ -1,8 +1,10 @@ const base = require('./karma.base.config.js') +process.env.CHROME_BIN = require('puppeteer').executablePath() + module.exports = function (config) { const options = Object.assign(base, { - browsers: ['PhantomJS'], + browsers: ['ChromeHeadless'], reporters: ['mocha', 'coverage'], coverageReporter: { reporters: [ @@ -13,7 +15,7 @@ module.exports = function (config) { singleRun: true, plugins: base.plugins.concat([ 'karma-coverage', - 'karma-phantomjs-launcher' + 'karma-chrome-launcher' ]) }) diff --git a/test/unit/karma.dev.config.js b/test/unit/karma.dev.config.js index f9dfc1b6..b9b01b22 100644 --- a/test/unit/karma.dev.config.js +++ b/test/unit/karma.dev.config.js @@ -1,11 +1,13 @@ const base = require('./karma.base.config.js') +process.env.CHROME_BIN = require('puppeteer').executablePath() + module.exports = function (config) { config.set(Object.assign(base, { - browsers: ['PhantomJS'], + browsers: ['ChromeHeadless'], reporters: ['progress'], plugins: base.plugins.concat([ - 'karma-phantomjs-launcher' + 'karma-chrome-launcher' ]) })) } diff --git a/yarn.lock b/yarn.lock index 4bf225d8..71f33d24 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3364,7 +3364,7 @@ extglob@^2.0.4: snapdragon "^0.8.1" to-regex "^3.0.1" -extract-zip@^1.6.5, extract-zip@^1.6.7: +extract-zip@^1.6.5, extract-zip@^1.6.6, extract-zip@^1.6.7: version "1.6.7" resolved "https://registry.yarnpkg.com/extract-zip/-/extract-zip-1.6.7.tgz#a840b4b8af6403264c8db57f4f1a74333ef81fe9" integrity sha1-qEC0uK9kAyZMjbV/Txp0Mz74H+k= @@ -5596,7 +5596,7 @@ mime@^1.6.0: resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1" integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg== -mime@^2.3.1: +mime@^2.0.3, mime@^2.3.1: version "2.4.0" resolved "https://registry.yarnpkg.com/mime/-/mime-2.4.0.tgz#e051fd881358585f3279df333fe694da0bcffdd6" integrity sha512-ikBcWwyqXQSHKtciCcctu9YfPbFYZ4+gbHEmE0Q8jzcTYQg5dHCr3g2wwAZjPoJfQVXZq6KXAjpXOTf5/cjT7w== @@ -6527,7 +6527,7 @@ progress@^1.1.8: resolved "https://registry.yarnpkg.com/progress/-/progress-1.1.8.tgz#e260c78f6161cdd9b0e56cc3e0a85de17c7a57be" integrity sha1-4mDHj2Fhzdmw5WzD4Khd4Xx6V74= -progress@^2.0.0: +progress@^2.0.0, progress@^2.0.1: version "2.0.3" resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8" integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA== @@ -6551,6 +6551,11 @@ proxy-agent@2.0.0: pac-proxy-agent "1" socks-proxy-agent "2" +proxy-from-env@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.0.0.tgz#33c50398f70ea7eb96d21f7b817630a55791c7ee" + integrity sha1-M8UDmPcOp+uW0h97gXYwpVeRx+4= + prr@~1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/prr/-/prr-1.0.1.tgz#d3fc114ba06995a45ec6893f484ceb1d78f5f476" @@ -6618,6 +6623,20 @@ punycode@^2.1.0: resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== +puppeteer@^1.11.0: + version "1.11.0" + resolved "https://registry.yarnpkg.com/puppeteer/-/puppeteer-1.11.0.tgz#63cdbe12b07275cd6e0b94bce41f3fcb20305770" + integrity sha512-iG4iMOHixc2EpzqRV+pv7o3GgmU2dNYEMkvKwSaQO/vMZURakwSOn/EYJ6OIRFYOque1qorzIBvrytPIQB3YzQ== + dependencies: + debug "^4.1.0" + extract-zip "^1.6.6" + https-proxy-agent "^2.2.1" + mime "^2.0.3" + progress "^2.0.1" + proxy-from-env "^1.0.0" + rimraf "^2.6.1" + ws "^6.1.0" + q@1.4.1: version "1.4.1" resolved "https://registry.yarnpkg.com/q/-/q-1.4.1.tgz#55705bcd93c5f3673530c2c2cbc0c2b3addc286e" @@ -8377,6 +8396,13 @@ write@^0.2.1: dependencies: mkdirp "^0.5.1" +ws@^6.1.0: + version "6.1.2" + resolved "https://registry.yarnpkg.com/ws/-/ws-6.1.2.tgz#3cc7462e98792f0ac679424148903ded3b9c3ad8" + integrity sha512-rfUqzvz0WxmSXtJpPMX2EeASXabOrSMk1ruMOV3JBTBjo4ac2lDjGGsbQSyxj8Odhw5fBib8ZKEjDNvgouNKYw== + dependencies: + async-limiter "~1.0.0" + ws@~3.3.1: version "3.3.3" resolved "https://registry.yarnpkg.com/ws/-/ws-3.3.3.tgz#f1cf84fe2d5e901ebce94efaece785f187a228f2"