1// @ts-check 2const minimist = require("minimist"); 3const os = require("os"); 4 5/** @type {CommandLineOptions} */ 6module.exports = minimist(process.argv.slice(2), { 7 boolean: ["debug", "dirty", "light", "colors", "lint", "lkg", "soft", "fix", "failed", "keepFailed", "force", "built"], 8 string: ["browser", "tests", "inspect", "host", "reporter", "stackTraceLimit", "timeout", "shards", "shardId"], 9 alias: { 10 "b": "browser", 11 "d": ["debug", "debug-brk"], 12 "i": ["inspect", "inspect-brk"], 13 "t": ["tests", "test"], 14 "ru": ["runners", "runner"], 15 "r": "reporter", 16 "c": ["colors", "color"], 17 "skippercent": "skipPercent", 18 "w": "workers", 19 "f": "fix" 20 }, 21 default: { 22 soft: false, 23 colors: process.env.colors || process.env.color || true, 24 debug: process.env.debug || process.env["debug-brk"] || process.env.d, 25 inspect: process.env.inspect || process.env["inspect-brk"] || process.env.i, 26 host: process.env.TYPESCRIPT_HOST || process.env.host || "node", 27 browser: process.env.browser || process.env.b || (os.platform() === "win32" ? "edge" : "chrome"), 28 timeout: process.env.timeout || 40000, 29 tests: process.env.test || process.env.tests || process.env.t, 30 runners: process.env.runners || process.env.runner || process.env.ru, 31 light: process.env.light === undefined || process.env.light !== "false", 32 reporter: process.env.reporter || process.env.r, 33 lint: process.env.lint || true, 34 fix: process.env.fix || process.env.f, 35 workers: process.env.workerCount || os.cpus().length, 36 failed: false, 37 keepFailed: false, 38 lkg: true, 39 dirty: false, 40 built: false 41 } 42}); 43 44if (module.exports.built) { 45 module.exports.lkg = false; 46} 47 48/** 49 * @typedef TypedOptions 50 * @property {boolean} debug 51 * @property {boolean} dirty 52 * @property {boolean} light 53 * @property {boolean} colors 54 * @property {boolean} lint 55 * @property {boolean} lkg 56 * @property {boolean} built 57 * @property {boolean} soft 58 * @property {boolean} fix 59 * @property {string} browser 60 * @property {string} tests 61 * @property {string} inspect 62 * @property {string} runners 63 * @property {string|number} workers 64 * @property {string} host 65 * @property {string} reporter 66 * @property {string} stackTraceLimit 67 * @property {string|number} timeout 68 * @property {boolean} failed 69 * @property {boolean} keepFailed 70 * 71 * @typedef {import("minimist").ParsedArgs & TypedOptions} CommandLineOptions 72 */ 73void 0; 74