-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathindex.js
More file actions
40 lines (34 loc) · 1.1 KB
/
Copy pathindex.js
File metadata and controls
40 lines (34 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
'use strict';
const { parseArgs } = require('node:util');
const convertLcovToCoveralls = require('./lib/convertLcovToCoveralls');
const sendToCoveralls = require('./lib/sendToCoveralls');
const { getBaseOptions, getOptions: getOptionsInternal } = require('./lib/getOptions');
const handleInput = require('./lib/handleInput');
const logger = require('./lib/logger');
// Parse CLI arguments
const { values, positionals } = parseArgs({
options: {
verbose: { type: 'boolean', short: 'v' },
stdout: { type: 'boolean', short: 's' },
},
strict: false,
args: process.argv.slice(2),
});
const cliOptions = {
...values,
_: positionals,
};
// Wrapper for getOptions that includes CLI options
const getOptions = async userOptions => {
return getOptionsInternal(userOptions, cliOptions);
};
module.exports = {
convertLcovToCoveralls,
sendToCoveralls: obj => sendToCoveralls(obj, cliOptions),
getBaseOptions,
getOptions,
handleInput: (input, userOptions) => handleInput(input, userOptions, cliOptions),
logger,
// Expose CLI options for backward compatibility with tests
options: cliOptions,
};