UNPKG

poku

Version:

🐷 Poku makes testing easy for Node.js, Bun, Deno, and you at the same time.

83 lines (72 loc) 3.59 kB
import { hr, log$1 as log, format } from "../modules/_shared.js"; import "node:path"; import "node:process"; import "node:os"; import "node:child_process"; import "node:assert"; import "node:assert/strict"; import "node:fs/promises"; import "node:net"; const b = (text) => `${format(text).bold()}`, i = (text) => `${format(text).italic()}`, u = (text) => `${format(text).underline()}`, d = (text) => `${format(text).dim()}`, options = i("[--options]"), paths = i("[paths]"), bullet = d("\u25CF"), summary = [ ["--concurrency", "Limit the number of tests running concurrently."], ["--config, -c", "Specify a configuration file."], ["--coverage", "Enable coverage collection using a coverage plugin."], ["--coverageConfig", "Path to a coverage configuration file."], ["--debug, -d", "Show detailed logs."], ["--denoAllow", "Allow permissions for Deno."], ["--denoDeny", "Deny permissions for Deno."], ["--enforce, -x", "Validate options before running tests."], ["--envFile", "Read and set an environment file."], ["--exclude", "Exclude by path using Regex to match files."], ["--failFast", "Stop tests at the first failure."], ["--filter", "Filter by path using Regex to match files."], ["--help, -h", "Show Poku's CLI basic usage."], ["--killPid", "Terminate the specified processes."], ["--killPort", "Terminate the specified ports."], ["--killRange", "Terminate the specified port ranges."], ["--listFiles", "Display all the files returned in the terminal."], ["--isolation", "Set test isolation mode (none, process). Default: process."], [ "--reporter, -r", "Specify the reporter: poku, dot, compact, focus, classic." ], ["--only", "Enable selective execution of tests."], ["--quiet, -q", "Run tests with no logs."], ["--sequential", "Run tests files sequentially."], ["--testNamePattern, -t", "Run only tests matching the given regex."], ["--testSkipPattern", "Skip tests matching the given regex."], ["--timeout", "Set the maximum time (ms) for each test file."], ["--version, -v", "Show Poku's installed version."], ["--watch, -w", "Watch for test events."], ["--watchInterval", "Set an interval for watch events."] ], sortedSummary = summary.sort(([a], [b2]) => a.localeCompare(b2)), largeEndPad = Math.max(...summary.map(([start]) => start.length)), header = ` \u{1F437} ${format(" Poku \u2014 CLI Usage ").bg("brightMagenta")} \u203A ${u(b("Usage:"))} poku ${options} ${paths} poku ${paths} ${options} \u203A ${u(b("Tips:"))} ${bullet} All CLI options use camel case pattern (e.g.: ${b("--failFast")}). ${bullet} Use ${b("=")} to set an option value (e.g.: ${b("--concurrency=4")}). ${bullet} If you're seeing this, ${u("feel special")} \u2728 `, main = ` \u{1F43D} ${format(" Poku \u2014 Options ").bg("brightMagenta")} \u203A ${u(b("Summary:"))} ${sortedSummary.map( ([command, description]) => `${command.padEnd(largeEndPad)} ${d(description)}` ).join(` `)} \u203A ${u(b("Notes:"))} ${bullet} For Glob support, see: ${u("https://poku.io/docs/documentation/poku/include-files#by-extending-glob-patterns-from-shell")} ${bullet} Avoid conflicts for environments with multiple platforms: ${u("https://poku.io/docs/tutorials/cross-platform")} `, footer = ` ${b("Documentation:")} ${u("https://poku.io/docs")} ${bullet} ${b("Poku")} is made with ${b("love")} and ${b("care")} in every detail. ${bullet} Give him a ${b("star")} to show your support \u{1F31F} `, help = () => { hr(), log(header.trim()), hr(), log(main.trim()), hr(), log(footer.trim()), hr(); }; export { help };