@moonsong-labs/moonwall-cli
Version:
Testing framework for the Moon family of projects
103 lines (101 loc) • 2.78 kB
JavaScript
import {
main
} from "../chunk-JFLW7AIU.js";
import {
fetchArtifact
} from "../chunk-UKF5VW3F.js";
import "../chunk-BQJSSQD3.js";
import "../chunk-BXT4DOIP.js";
import {
generateConfig
} from "../chunk-FN5ZWO77.js";
import {
runNetwork
} from "../chunk-4KPQVQED.js";
import {
testCmd
} from "../chunk-NWVZXZ7E.js";
import "../chunk-WICDGWJQ.js";
import "../chunk-XIBPDQIU.js";
import "../chunk-CY4QSJCG.js";
import "../chunk-75ODDMN6.js";
import "../chunk-3P647NU6.js";
import "../chunk-7B2TVWXJ.js";
// src/cmds/entrypoint.ts
import "@moonbeam-network/api-augment";
import yargs from "yargs";
import { hideBin } from "yargs/helpers";
yargs(hideBin(process.argv)).usage("Usage: $0").version("2.0.0").command(`init`, "Run tests for a given Environment", async () => {
await generateConfig();
}).command(
`download <artifact> [bin-version] [path]`,
"Download a published x86 artifact from GitHub",
(yargs2) => {
return yargs2.positional("artifact", {
describe: "Name of artifact to download\n[ moonbeam | polkadot | *-runtime ]"
}).positional("bin-version", {
describe: "Artifact version to download",
default: "latest"
}).positional("path", {
describe: "Path where to save artifacts",
type: "string",
default: "./"
}).option("overwrite", {
describe: "If file exists, should it be overwritten?",
type: "boolean",
alias: "d",
default: true
}).option("output-name", {
describe: "Rename downloaded file to this name",
alias: "o",
type: "string"
});
},
async (argv) => {
await fetchArtifact(argv);
}
).command(
`test <envName> [GrepTest]`,
"Run tests for a given Environment",
(yargs2) => {
return yargs2.positional("envName", {
describe: "Network environment to run tests against",
array: true,
string: true
}).positional("GrepTest", {
type: "string",
description: "Pattern to grep test ID/Description to run"
});
},
async (args) => {
await testCmd(args.envName.toString(), { testNamePattern: args.GrepTest });
process.exit(0);
}
).command(
`run <envName>`,
"Start new network found in global config",
(yargs2) => {
return yargs2.positional("envName", {
describe: "Network environment to start"
});
},
async (argv) => {
await runNetwork(argv);
process.exit(0);
}
).command("*", "Run the guided walkthrough", async () => {
await main();
}).options({
configFile: {
type: "string",
alias: "c",
description: "path to MoonwallConfig file",
default: "./moonwall.config.json"
}
// environment: {
// type: "string",
// alias: "t",
// description: "name of environment tests to run",
// demandOption: false,
// },
}).parse();