1import minimist from "minimist"; 2import os from "os"; 3 4const ci = ["1", "true"].includes(process.env.CI ?? ""); 5 6const parsed = minimist(process.argv.slice(2), { 7 boolean: ["dirty", "light", "colors", "lkg", "soft", "fix", "failed", "keepFailed", "force", "built", "ci"], 8 string: ["browser", "tests", "break", "host", "reporter", "stackTraceLimit", "timeout", "shards", "shardId"], 9 alias: { 10 /* eslint-disable quote-props */ 11 "b": "browser", 12 "i": ["inspect", "inspect-brk", "break", "debug", "debug-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 /* eslint-enable quote-props */ 21 }, 22 default: { 23 soft: false, 24 colors: process.env.colors || process.env.color || true, 25 debug: process.env.debug || process.env["debug-brk"] || process.env.d, 26 inspect: process.env.inspect || process.env["inspect-brk"] || process.env.i, 27 host: process.env.TYPESCRIPT_HOST || process.env.host || "node", 28 browser: process.env.browser || process.env.b || (os.platform() === "win32" ? "edge" : "chrome"), 29 timeout: process.env.timeout || 40000, 30 tests: process.env.test || process.env.tests || process.env.t, 31 runners: process.env.runners || process.env.runner || process.env.ru, 32 light: process.env.light === undefined || process.env.light !== "false", 33 reporter: process.env.reporter || process.env.r, 34 fix: process.env.fix || process.env.f, 35 workers: process.env.workerCount || ((os.cpus().length - (ci ? 0 : 1)) || 1), 36 failed: false, 37 keepFailed: false, 38 lkg: true, 39 dirty: false, 40 built: false, 41 ci, 42 } 43}); 44 45/** @type {CommandLineOptions} */ 46const options = /** @type {any} */ (parsed); 47 48if (options.built) { 49 options.lkg = false; 50} 51 52export default options; 53 54 55 56/** 57 * @typedef CommandLineOptions 58 * @property {boolean} dirty 59 * @property {boolean} light 60 * @property {boolean} colors 61 * @property {boolean} lkg 62 * @property {boolean} built 63 * @property {boolean} soft 64 * @property {boolean} fix 65 * @property {string} browser 66 * @property {string} tests 67 * @property {string | boolean} break 68 * @property {string | boolean} inspect 69 * @property {string} runners 70 * @property {string|number} workers 71 * @property {string} host 72 * @property {string} reporter 73 * @property {string} stackTraceLimit 74 * @property {string|number} timeout 75 * @property {boolean} failed 76 * @property {boolean} keepFailed 77 * @property {boolean} ci 78 * @property {string} shards 79 * @property {string} shardId 80 */ 81void 0; 82