Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | #!/usr/bin/env node // eslint-disable-next-line @typescript-eslint/no-var-requires require("source-map-support").install(); import { join } from "path"; import yargs from "yargs"; import { hideBin } from "yargs/helpers"; import { logger, setLoggingLevelFromConfig } from "../logger"; import { stopCommand, runCommand, validateSpecCoverageCommand } from "./commands"; export const DEFAULT_PORT = 3000; const run = async () => { await yargs(hideBin(process.argv)) .help() .strict() .env("AUTOREST_TESTSERVER") .option("verbose", { alias: "v", type: "boolean", description: "Run with verbose logging level.", }) .option("debug", { type: "boolean", description: "Run with debug logging level.", }) .option("level", { type: "string", description: "Run with given logging level.", }) .option("port", { alias: "p", type: "number", description: "Port where to host the server", default: DEFAULT_PORT, }) .option("coverageDirectory", { type: "string", description: "Path of the directory where the coverage reports should be saved.", default: join(process.cwd(), "coverage"), }) .middleware((args) => { setLoggingLevelFromConfig(args); }) .command( ["$0", "run"], "Run the autorest test server.", (cmd) => cmd.option("appendCoverage", { type: "boolean", description: "Load the existing coverage reports and append to it instead of starting fresh.", }), (args) => runCommand(args), ) .command( "stop", "Stop the autorest test server running at the provided port.", () => null, (args) => stopCommand(args), ) .command( "validate-spec-coverage", "Validate there is a mock api for all the path defined in the specs", (cmd) => cmd.option("maxErrorCount", { description: "Maximum number of errors allowed", default: 0, }), (args) => validateSpecCoverageCommand(args), ).argv; }; run().catch((e) => { logger.error("Error", e); process.exit(1); }); |