From 0aba5286824d653f95a6454de0fbf91d4a5410b8 Mon Sep 17 00:00:00 2001 From: Brandon Lo Date: Thu, 11 Jul 2019 09:49:11 -0400 Subject: 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 --- tests/karma.conf.js | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 tests/karma.conf.js (limited to 'tests/karma.conf.js') 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' + } + } + }) +} -- cgit 1.2.3-korg