aboutsummaryrefslogtreecommitdiffstats
path: root/tests/karma.conf.js
diff options
context:
space:
mode:
authorBrandon Lo <lobrandon1217@gmail.com>2019-07-11 09:49:11 -0400
committerBrandon Lo <lobrandon1217@gmail.com>2019-07-16 11:39:24 -0400
commit0aba5286824d653f95a6454de0fbf91d4a5410b8 (patch)
tree4c5f49e916beba3a7b82a7e20a2650f62f98e60a /tests/karma.conf.js
parent69824a2839f8841c04d964ea341b4a8b1379aa51 (diff)
LAAS-44: Unit Test Javascript
Add Karma, Mocha, and Chai NPM packages to allow for browser based front-end JavaScript testing. Not all functions are tested, but a lot of the required behavior is. This allows for new JS unit tests in future patches. Change-Id: I2ac2a865ed3a458d8f5ebdeb7c2b4defda24fd41 Signed-off-by: Brandon Lo <lobrandon1217@gmail.com>
Diffstat (limited to 'tests/karma.conf.js')
-rw-r--r--tests/karma.conf.js87
1 files changed, 87 insertions, 0 deletions
diff --git a/tests/karma.conf.js b/tests/karma.conf.js
new file mode 100644
index 0000000..4a1fb95
--- /dev/null
+++ b/tests/karma.conf.js
@@ -0,0 +1,87 @@
+// Karma configuration
+// Generated on Mon Jul 08 2019 14:57:05 GMT-0400 (Eastern Daylight Time)
+
+module.exports = function(config) {
+ config.set({
+
+ // base path that will be used to resolve all patterns (eg. files, exclude)
+ basePath: '',
+
+
+ // frameworks to use
+ // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
+ frameworks: ['mocha', 'chai'],
+
+
+ // list of files / patterns to load in the browser
+ files: [
+ 'https://code.jquery.com/jquery-3.4.1.min.js',
+ '../src/static/js/dashboard.js',
+ '../src/static/js/mxClient.min.js',
+ 'tests/*.js'
+ ],
+
+
+ // list of files / patterns to exclude
+ exclude: [
+ ],
+
+
+ // preprocess matching files before serving them to the browser
+ // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
+ preprocessors: {
+ },
+
+
+ // test results reporter to use
+ // possible values: 'dots', 'progress'
+ // available reporters: https://npmjs.org/browse/keyword/karma-reporter
+ reporters: ['dots'],
+
+
+ // web server port
+ port: 9876,
+
+
+ // enable / disable colors in the output (reporters and logs)
+ colors: true,
+
+
+ // level of logging
+ // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
+ logLevel: config.LOG_ERROR,
+
+
+ // enable / disable watching file and executing tests whenever any file changes
+ autoWatch: false,
+
+
+ // start these browsers
+ // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
+ browsers: ['ChromeHeadless', 'FirefoxHeadless'],
+
+
+ // Continuous Integration mode
+ // if true, Karma captures browsers, runs the tests and exits
+ singleRun: true,
+
+ // Concurrency level
+ // how many browser should be started simultaneous
+ concurrency: Infinity,
+
+ // Custom web browsers
+ customLaunchers: {
+ FirefoxHeadless: {
+ base: 'Firefox',
+ flags: ['-headless']
+ }
+ },
+
+ // Use TDD instead of BDD for Mocha
+ client: {
+ mocha: {
+ ui: 'tdd'
+ }
+ }
+ })
+}