Tone.js/gulp/karma.conf.js

126 lines
3.6 KiB
JavaScript
Raw Normal View History

2016-03-04 21:25:44 +00:00
// Karma configuration
// Generated on Mon Feb 01 2016 22:48:23 GMT-0500 (EST)
2018-01-16 16:04:47 +00:00
var BROWSERS = ["HeadlessChrome", "HeadlessFirefox", "Safari"];
// var BROWSERS = ['Safari']
if (process.env.BROWSER === "chrome"){
BROWSERS = ["HeadlessChrome"];
} else if (process.env.BROWSER === "firefox"){
BROWSERS = ["HeadlessFirefox"];
} else if (process.env.BROWSER === "safari"){
BROWSERS = ["Safari"];
}
2018-01-16 16:04:47 +00:00
module.exports = function(config){
2017-03-26 18:51:25 +00:00
var configuration = {
2016-03-04 21:25:44 +00:00
2017-03-26 18:51:25 +00:00
// base path that will be used to resolve all patterns (eg. files, exclude)
2018-01-16 16:04:47 +00:00
basePath : "../",
2016-03-04 21:25:44 +00:00
2017-03-26 18:51:25 +00:00
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
2018-01-16 16:04:47 +00:00
frameworks : ["mocha", "requirejs"],
2016-03-04 21:25:44 +00:00
2017-03-26 18:51:25 +00:00
// list of files / patterns to load in the browser
2018-01-16 16:04:47 +00:00
files : [
2017-03-26 18:51:25 +00:00
// '../test/helper/Test.js',
2018-01-16 16:04:47 +00:00
"test/karmaTest.js",
{ pattern : "test/*/*.js", included : false },
{ pattern : "examples/*.html", included : false },
{ pattern : "examples/scripts/*.js", included : false },
{ pattern : "examples/style/*.css", included : false },
{ pattern : "examples/audio/*/*.mp3", included : false },
{ pattern : "examples/audio/*.mp3", included : false },
{ pattern : "examples/audio/*/*.png", included : false },
{ pattern : "build/*.js", included : false },
{ pattern : "test/audio/*", included : false },
{ pattern : "test/audio/*/*", included : false },
2018-01-16 16:04:47 +00:00
{ pattern : "Tone/*/*.js", included : false },
],
2016-03-04 21:25:44 +00:00
2017-03-26 18:51:25 +00:00
// list of files to exclude
2018-01-16 16:04:47 +00:00
exclude : [],
2016-03-04 21:25:44 +00:00
2017-03-26 18:51:25 +00:00
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
2018-01-16 16:04:47 +00:00
preprocessors : {
"Tone/!(shim)/*.js" : ["coverage"]
2017-04-30 17:02:35 +00:00
},
2016-03-04 21:25:44 +00:00
2017-03-26 18:51:25 +00:00
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
2018-01-16 16:04:47 +00:00
reporters : ["dots", "coverage"],
2017-04-30 17:02:35 +00:00
2018-01-16 16:04:47 +00:00
coverageReporter : {
type : "lcov",
dir : "test/coverage/"
2017-04-30 17:02:35 +00:00
},
2016-03-04 21:25:44 +00:00
2017-03-26 18:51:25 +00:00
//plugins
plugins : [
2018-01-16 16:04:47 +00:00
"karma-coverage",
"karma-mocha",
"karma-requirejs",
"karma-chrome-launcher",
"karma-firefox-launcher",
"karma-safari-launcher"
2017-03-26 18:51:25 +00:00
],
2016-03-04 21:25:44 +00:00
2018-01-16 16:04:47 +00:00
client : {
mocha : {
reporter : "html", // change Karma's debug.html to the mocha web reporter
ui : "bdd"
2017-03-26 18:51:25 +00:00
}
},
2016-03-04 21:25:44 +00:00
2017-03-26 18:51:25 +00:00
// web server port
2018-01-16 16:04:47 +00:00
port : 9876,
2016-03-04 21:25:44 +00:00
2017-03-26 18:51:25 +00:00
// enable / disable colors in the output (reporters and logs)
2018-01-16 16:04:47 +00:00
colors : true,
2016-03-04 21:25:44 +00:00
// set the inactivity level to longer
2017-11-24 22:07:29 +00:00
browserNoActivityTimeout : 40000,
2017-03-26 18:51:25 +00:00
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
2018-01-16 16:04:47 +00:00
logLevel : config.LOG_ERROR,
2016-03-04 21:25:44 +00:00
2017-03-26 18:51:25 +00:00
// enable / disable watching file and executing tests whenever any file changes
2018-01-16 16:04:47 +00:00
autoWatch : false,
2016-03-04 21:25:44 +00:00
2017-03-26 18:51:25 +00:00
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
2018-01-16 16:04:47 +00:00
browsers : BROWSERS,
2016-03-04 21:25:44 +00:00
2017-03-26 18:51:25 +00:00
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
2018-01-16 16:04:47 +00:00
singleRun : false,
2016-03-04 21:25:44 +00:00
2017-03-26 18:51:25 +00:00
// Concurrency level
// how many browser should be started simultaneous
2017-11-29 21:14:53 +00:00
// concurrency: process.env.TRAVIS ? 1 : Infinity,
2018-01-16 16:04:47 +00:00
concurrency : Infinity,
2016-03-04 21:25:44 +00:00
2017-03-26 18:51:25 +00:00
//custom launcher for travis
2018-01-16 16:04:47 +00:00
customLaunchers : {
HeadlessChrome : {
base : "ChromeHeadless",
flags : ["--no-sandbox", "--use-fake-ui-for-media-stream", "--use-fake-device-for-media-stream", "--autoplay-policy=no-user-gesture-required"]
2017-10-26 18:11:47 +00:00
},
2018-01-16 16:04:47 +00:00
HeadlessFirefox : {
base : "Firefox",
flags : ["-headless"],
prefs : {
"media.navigator.permission.disabled" : true,
"focusmanager.testmode" : true
2017-10-26 18:11:47 +00:00
}
}
2017-03-26 18:51:25 +00:00
}
};
config.set(configuration);
2016-03-04 21:25:44 +00:00
};