From f92d6f05c4dcd4a3a0616871e10b31edae9dfad5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=96=9B=E5=AE=9A=E8=B0=94=E7=9A=84=E7=8C=AB?= Date: Sat, 5 Jan 2019 04:46:04 +0800 Subject: [PATCH] Build: Add karma-chrome-launcher support (#11027) * Revert "Revert "Build: Use karma-chrome-launcher to run tests (#10898)" (#10973)" This reverts commit 536611ae7e9b752b1c0dcc0e7f5def861a88aee0. * Build: add devdeps puppeteer@1.9.0 * Chore: set the path to chromium binary --- karma.conf.js | 11 +++++++++-- package.json | 4 ++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/karma.conf.js b/karma.conf.js index 0ffab8bc520..e8a027e540e 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -1,5 +1,7 @@ "use strict"; +process.env.CHROME_BIN = require("puppeteer").executablePath(); + module.exports = function(config) { config.set({ @@ -67,8 +69,13 @@ module.exports = function(config) { // start these browsers // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher - browsers: ["PhantomJS"], - + browsers: ["HeadlessChrome"], + customLaunchers: { + HeadlessChrome: { + base: 'ChromeHeadless', + flags: [ '--no-sandbox', ], + }, + }, // Continuous Integration mode // if true, Karma captures browsers, runs the tests and exits diff --git a/package.json b/package.json index 9860ef9c63d..7e3cf2fc6e7 100644 --- a/package.json +++ b/package.json @@ -97,17 +97,17 @@ "jsdoc": "^3.5.5", "karma": "^3.0.0", "karma-babel-preprocessor": "^7.0.0", + "karma-chrome-launcher": "^2.2.0", "karma-mocha": "^1.3.0", "karma-mocha-reporter": "^2.2.3", - "karma-phantomjs-launcher": "^1.0.4", "leche": "^2.2.3", "load-perf": "^0.2.0", "markdownlint": "^0.11.0", "mocha": "^5.0.5", "mock-fs": "^4.6.0", "npm-license": "^0.3.3", - "phantomjs-prebuilt": "^2.1.16", "proxyquire": "^2.0.1", + "puppeteer": "^1.9.0", "shelljs": "^0.8.2", "sinon": "^3.3.0", "temp": "^0.8.3",