import { captureEvent } from "../common/analytics/lib.js";
import { identify } from "../common/middleware/user-identification.js";
import setBlocking from "../common/output.js";
import { validTestDirectoryValidator } from "../common/validators/file-system-validator.js";
import { YargsChecker } from "../common/validators/lib.js";
import { test } from "../test/handler.js";
export default {
    desc: "Runs the tests under /tests against an endpoint",
    command: "test",
    builder: (yargs) => {
        return yargs
            .option("endpoint", {
            type: "string",
            describe: "The URL of the Zuplo API to test against",
        })
            .option("filter", {
            type: "string",
            describe: "A filter to run a subset of tests (e.g., --filter 'test name' or --filter '/test-name-regex/')",
        })
            .option("dir", {
            type: "string",
            describe: "The directory containing your Zuplo API",
            default: ".",
            normalize: true,
            hidden: true,
        })
            .check(async (argv) => {
            return await new YargsChecker(validTestDirectoryValidator).check(argv);
        })
            .middleware([setBlocking, identify]);
    },
    handler: async (argv) => {
        await captureEvent({ argv, event: "zuplo test" });
        await test(argv);
    },
};
//# sourceMappingURL=test.js.map