|
| 1 | +/*! |
| 2 | + * Licensed to the Apache Software Foundation (ASF) under one |
| 3 | + * or more contributor license agreements. See the NOTICE file |
| 4 | + * distributed with this work for additional information |
| 5 | + * regarding copyright ownership. The ASF licenses this file |
| 6 | + * to you under the Apache License, Version 2.0 (the |
| 7 | + * "License"); you may not use this file except in compliance |
| 8 | + * with the License. You may obtain a copy of the License at |
| 9 | + * |
| 10 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + * |
| 12 | + * Unless required by applicable law or agreed to in writing, |
| 13 | + * software distributed under the License is distributed on an |
| 14 | + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | + * KIND, either express or implied. See the License for the |
| 16 | + * specific language governing permissions and limitations |
| 17 | + * under the License. |
| 18 | + */ |
| 19 | + |
| 20 | +// Use Chrome executable installed through npm |
| 21 | +process.env.CHROME_BIN = require('puppeteer').executablePath(); |
| 22 | + |
| 23 | +module.exports = function (config) { |
| 24 | + config.set({ |
| 25 | + |
| 26 | + // base path that will be used to resolve all patterns (eg. files, exclude) |
| 27 | + basePath: '', |
| 28 | + |
| 29 | + // frameworks to use |
| 30 | + // available frameworks: https://npmjs.org/browse/keyword/karma-adapter |
| 31 | + frameworks: ['jasmine'], |
| 32 | + |
| 33 | + // list of files / patterns to load in the browser |
| 34 | + files: [ |
| 35 | + 'pkg/cordova.test.js', |
| 36 | + 'test/**/test.*.js' |
| 37 | + ], |
| 38 | + |
| 39 | + // list of files / patterns to exclude |
| 40 | + exclude: [ |
| 41 | + ], |
| 42 | + |
| 43 | + // preprocess matching files before serving them to the browser |
| 44 | + // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor |
| 45 | + preprocessors: { |
| 46 | + }, |
| 47 | + |
| 48 | + // test results reporter to use |
| 49 | + // possible values: 'dots', 'progress' |
| 50 | + // available reporters: https://npmjs.org/browse/keyword/karma-reporter |
| 51 | + reporters: ['progress'], |
| 52 | + |
| 53 | + // web server port |
| 54 | + port: 9876, |
| 55 | + |
| 56 | + // enable / disable colors in the output (reporters and logs) |
| 57 | + colors: true, |
| 58 | + |
| 59 | + // level of logging |
| 60 | + // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG |
| 61 | + logLevel: config.LOG_INFO, |
| 62 | + |
| 63 | + // enable / disable watching file and executing tests whenever any file changes |
| 64 | + autoWatch: false, |
| 65 | + |
| 66 | + // start these browsers |
| 67 | + // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher |
| 68 | + browsers: ['ChromeHeadless'], |
| 69 | + |
| 70 | + // Continuous Integration mode |
| 71 | + // if true, Karma captures browsers, runs the tests and exits |
| 72 | + singleRun: true, |
| 73 | + |
| 74 | + // Concurrency level |
| 75 | + // how many browser should be started simultaneous |
| 76 | + concurrency: Infinity |
| 77 | + }); |
| 78 | + |
| 79 | + if (process.env.TRAVIS) { |
| 80 | + config.set({ |
| 81 | + browsers: ['ChromeHeadlessNoSandbox'], |
| 82 | + customLaunchers: { |
| 83 | + ChromeHeadlessNoSandbox: { |
| 84 | + base: 'ChromeHeadless', |
| 85 | + flags: ['--no-sandbox'] |
| 86 | + } |
| 87 | + } |
| 88 | + }); |
| 89 | + } |
| 90 | +}; |
0 commit comments