2015-07-24 23:50:49 +00:00
|
|
|
/*****************************************************************************
|
2017-04-05 21:35:12 +00:00
|
|
|
* Open MCT, Copyright (c) 2014-2017, United States Government
|
2015-07-24 23:50:49 +00:00
|
|
|
* as represented by the Administrator of the National Aeronautics and Space
|
|
|
|
* Administration. All rights reserved.
|
|
|
|
*
|
2016-07-12 23:21:58 +00:00
|
|
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
2015-07-24 23:50:49 +00:00
|
|
|
* "License"); you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
* under the License.
|
|
|
|
*
|
2016-07-12 23:21:58 +00:00
|
|
|
* Open MCT includes source code licensed under additional open source
|
2015-07-24 23:50:49 +00:00
|
|
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
|
|
|
* this source code distribution or the Licensing information page available
|
|
|
|
* at runtime from the About dialog for additional information.
|
|
|
|
*****************************************************************************/
|
|
|
|
|
2016-03-01 21:37:52 +00:00
|
|
|
/*global module,process*/
|
2015-07-21 21:24:17 +00:00
|
|
|
|
2018-08-07 21:47:50 +00:00
|
|
|
const devMode = process.env.NODE_ENV !== 'production';
|
2020-07-20 22:12:53 +00:00
|
|
|
const browsers = [process.env.NODE_ENV === 'debug' ? 'ChromeDebugging' : 'FirefoxHeadless'];
|
2020-04-30 23:57:53 +00:00
|
|
|
const coverageEnabled = process.env.COVERAGE === 'true';
|
|
|
|
const reporters = ['progress', 'html'];
|
|
|
|
|
|
|
|
if (coverageEnabled) {
|
|
|
|
reporters.push('coverage-istanbul');
|
|
|
|
}
|
2015-07-21 21:24:17 +00:00
|
|
|
|
2018-08-07 21:47:50 +00:00
|
|
|
module.exports = (config) => {
|
|
|
|
const webpackConfig = require('./webpack.config.js');
|
|
|
|
delete webpackConfig.output;
|
2015-07-21 21:24:17 +00:00
|
|
|
|
2020-04-30 23:57:53 +00:00
|
|
|
if (!devMode || coverageEnabled) {
|
2018-08-07 21:47:50 +00:00
|
|
|
webpackConfig.module.rules.push({
|
|
|
|
test: /\.js$/,
|
2020-04-30 23:57:53 +00:00
|
|
|
exclude: /node_modules|example|lib|dist/,
|
|
|
|
use: {
|
|
|
|
loader: 'istanbul-instrumenter-loader',
|
|
|
|
options: {
|
|
|
|
esModules: true
|
|
|
|
}
|
|
|
|
}
|
2018-08-07 21:47:50 +00:00
|
|
|
});
|
|
|
|
}
|
2015-07-21 21:24:17 +00:00
|
|
|
|
2018-08-07 21:47:50 +00:00
|
|
|
config.set({
|
|
|
|
basePath: '',
|
|
|
|
frameworks: ['jasmine'],
|
|
|
|
files: [
|
|
|
|
'platform/**/*Spec.js',
|
|
|
|
'src/**/*Spec.js'
|
|
|
|
],
|
2015-07-21 21:24:17 +00:00
|
|
|
port: 9876,
|
2020-04-30 23:57:53 +00:00
|
|
|
reporters: reporters,
|
2019-10-10 19:25:24 +00:00
|
|
|
browsers: browsers,
|
|
|
|
customLaunchers: {
|
|
|
|
ChromeDebugging: {
|
|
|
|
base: 'Chrome',
|
|
|
|
flags: ['--remote-debugging-port=9222'],
|
|
|
|
debug: true
|
|
|
|
}
|
|
|
|
},
|
2015-07-21 21:24:17 +00:00
|
|
|
colors: true,
|
|
|
|
logLevel: config.LOG_INFO,
|
|
|
|
autoWatch: true,
|
2020-04-30 23:57:53 +00:00
|
|
|
// HTML test reporting.
|
|
|
|
htmlReporter: {
|
|
|
|
outputDir: "dist/reports/tests",
|
|
|
|
preserveDescribeNesting: true,
|
|
|
|
foldAll: false
|
|
|
|
},
|
|
|
|
coverageIstanbulReporter: {
|
|
|
|
fixWebpackSourcePaths: true,
|
2016-03-01 21:37:52 +00:00
|
|
|
dir: process.env.CIRCLE_ARTIFACTS ?
|
|
|
|
process.env.CIRCLE_ARTIFACTS + '/coverage' :
|
2016-07-21 19:07:28 +00:00
|
|
|
"dist/reports/coverage",
|
2020-04-30 23:57:53 +00:00
|
|
|
reports: ['html', 'lcovonly', 'text-summary'],
|
|
|
|
thresholds: {
|
2016-03-04 01:14:04 +00:00
|
|
|
global: {
|
2020-04-30 23:57:53 +00:00
|
|
|
lines: 62
|
2016-03-04 01:14:04 +00:00
|
|
|
}
|
|
|
|
}
|
2016-01-08 20:06:12 +00:00
|
|
|
},
|
2018-08-07 21:47:50 +00:00
|
|
|
preprocessors: {
|
2020-04-30 23:57:53 +00:00
|
|
|
'platform/**/*Spec.js': ['webpack', 'sourcemap'],
|
|
|
|
'src/**/*Spec.js': ['webpack', 'sourcemap']
|
2018-08-07 21:47:50 +00:00
|
|
|
},
|
|
|
|
webpack: webpackConfig,
|
|
|
|
webpackMiddleware: {
|
|
|
|
stats: 'errors-only',
|
|
|
|
logLevel: 'warn'
|
|
|
|
},
|
2020-07-20 22:12:53 +00:00
|
|
|
singleRun: true,
|
|
|
|
browserNoActivityTimeout: 90000
|
2015-07-21 21:24:17 +00:00
|
|
|
});
|
2018-08-07 21:47:50 +00:00
|
|
|
}
|