feat: add toolbox contract shell and testkit
This commit is contained in:
28
packages/testkit/src/cli.ts
Normal file
28
packages/testkit/src/cli.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
import { checkToolboxDist } from "./check.js";
|
||||
|
||||
function usage(): void {
|
||||
console.log("Usage: toolbox-check <dist>");
|
||||
}
|
||||
|
||||
const arguments_ = process.argv.slice(2);
|
||||
if (arguments_.includes("--help") || arguments_.includes("-h")) {
|
||||
usage();
|
||||
} else if (arguments_.length !== 1) {
|
||||
usage();
|
||||
process.exitCode = 2;
|
||||
} else {
|
||||
checkToolboxDist(arguments_[0] as string)
|
||||
.then((report) => {
|
||||
console.log(
|
||||
`toolbox-check: ${report.app.id}@${report.app.version} passed (${report.checkedFiles.length} files, standalone + contextual smoke checks)`,
|
||||
);
|
||||
})
|
||||
.catch((error: unknown) => {
|
||||
console.error(
|
||||
`toolbox-check: ${error instanceof Error ? error.message : String(error)}`,
|
||||
);
|
||||
process.exitCode = 1;
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user