pact-toolbox
Version:
A tool to help you build, test and deploy your Pact smart contracts
49 lines (47 loc) • 1.39 kB
JavaScript
const require_chunk = require('./chunk-CUT6urMc.cjs');
const citty = require_chunk.__toESM(require("citty"));
const __pact_toolbox_config = require_chunk.__toESM(require("@pact-toolbox/config"));
const __pact_toolbox_test = require_chunk.__toESM(require("@pact-toolbox/test"));
const vitest_node = require_chunk.__toESM(require("vitest/node"));
//#region src/commands/test.ts
async function runVitest({ mode = "test", watch = false, filters = [] } = {}) {
const vitest = await (0, vitest_node.startVitest)(mode, filters, {
watch,
run: !watch,
testTimeout: 1e4
});
if (!watch) await vitest?.exit();
}
const testCommand = (0, citty.defineCommand)({
meta: {
name: "test",
description: "Run tests using the configured test runner and network"
},
args: {
watch: {
type: "boolean",
name: "watch",
alias: "w",
description: "Watch for changes and re-run tests",
required: false,
default: false
},
replOnly: {
type: "boolean",
name: "repl-only",
alias: "r",
description: "Run REPL tests only",
required: false,
default: false
}
},
run: async ({ args }) => {
const { replOnly, watch } = args;
const config = await (0, __pact_toolbox_config.resolveConfig)();
await (0, __pact_toolbox_test.runReplTests)(config);
if (replOnly === true) return;
await runVitest({ watch });
}
});
//#endregion
exports.testCommand = testCommand;