diff --git a/circle.yml b/circle.yml index eb88167f53..d163b3ee0c 100644 --- a/circle.yml +++ b/circle.yml @@ -13,3 +13,6 @@ deployment: branch: mobile heroku: appname: openmctweb-staging-deux +test: + post: + - npm run jshint --silent diff --git a/example/export/ExportTelemetryAsCSVAction.js b/example/export/ExportTelemetryAsCSVAction.js index d8d29ef83c..89a1324f59 100644 --- a/example/export/ExportTelemetryAsCSVAction.js +++ b/example/export/ExportTelemetryAsCSVAction.js @@ -57,14 +57,23 @@ define([], function () { rows = [], row, i; + + function copyDomainsToRow(row, index) { + domains.forEach(function (domain) { + row[domain.name] = series.getDomainValue(index, domain.key); + }); + } + + function copyRangesToRow(row, index) { + ranges.forEach(function (range) { + row[range.name] = series.getRangeValue(index, range.key); + }); + } + for (i = 0; i < series.getPointCount(); i += 1) { row = {}; - domains.forEach(function (domain) { - row[domain.name] = series.getDomainValue(i, domain.key); - }); - ranges.forEach(function (range) { - row[range.name] = series.getRangeValue(i, range.key); - }); + copyDomainsToRow(row, i); + copyRangesToRow(row, i); rows.push(row); } exportService.exportCSV(rows, { headers: headers }); @@ -77,4 +86,4 @@ define([], function () { }; return ExportTelemetryAsCSVAction; -}); \ No newline at end of file +}); diff --git a/karma.conf.js b/karma.conf.js index e63b6712ef..20624e4713 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -20,7 +20,7 @@ * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global module*/ +/*global module,process*/ module.exports = function(config) { config.set({ @@ -58,7 +58,7 @@ module.exports = function(config) { // Test results reporter to use // Possible values: 'dots', 'progress' // Available reporters: https://npmjs.org/browse/keyword/karma-reporter - reporters: ['progress', 'coverage', 'html'], + reporters: ['progress', 'coverage', 'html', 'junit'], // Web server port. port: 9876, @@ -79,7 +79,9 @@ module.exports = function(config) { // Code coverage reporting. coverageReporter: { - dir: "dist/coverage" + dir: process.env.CIRCLE_ARTIFACTS ? + process.env.CIRCLE_ARTIFACTS + '/coverage' : + "dist/coverage" }, // HTML test reporting. @@ -89,6 +91,10 @@ module.exports = function(config) { foldAll: false }, + junitReporter: { + outputDir: process.env.CIRCLE_TEST_REPORTS || 'target/junit' + }, + // Continuous Integration mode. // If true, Karma captures browsers, runs the tests and exits. singleRun: true diff --git a/package.json b/package.json index e93587bc49..c0afb1c9ce 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "karma-coverage": "^0.5.3", "karma-html-reporter": "^0.2.7", "karma-jasmine": "^0.1.5", + "karma-junit-reporter": "^0.3.8", "karma-phantomjs-launcher": "^1.0.0", "karma-requirejs": "^0.2.2", "lodash": "^3.10.1", @@ -43,7 +44,7 @@ "scripts": { "start": "node app.js", "test": "karma start --single-run", - "jshint": "jshint platform example || exit 0", + "jshint": "jshint platform example", "watch": "karma start", "jsdoc": "jsdoc -c jsdoc.json -r -d target/docs/api", "otherdoc": "node docs/gendocs.js --in docs/src --out target/docs --suppress-toc 'docs/src/index.md|docs/src/process/index.md'",