1 | (function (Joi, util, logger) {
|
2 | 'use strict';
|
3 |
|
4 | var validFormats = ['lcov'];
|
5 | var formatValidation = Joi.string().valid(validFormats).required();
|
6 |
|
7 | module.exports = {
|
8 | getParser: function getParser(coverageFormat) {
|
9 | var validFormat = Joi.validate(coverageFormat, formatValidation);
|
10 |
|
11 | if (validFormat.error) {
|
12 | logger.error(validFormat.error);
|
13 | throw new Error(util.format('Expected one of the following supported formats: %j, but got [%s]', validFormats, coverageFormat));
|
14 | }
|
15 |
|
16 | logger.debug('Creating coverage parser for: ' + coverageFormat);
|
17 | return require('./impl/' + coverageFormat);
|
18 | }
|
19 | };
|
20 | }(require('joi'), require('util'), require('./logger')()));
|