@metamask/snaps-jest
Version:
A Jest preset for end-to-end testing MetaMask Snaps, including a Jest environment, and a set of Jest matchers
24 lines • 1.04 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getOptions = void 0;
const superstruct_1 = require("@metamask/superstruct");
const SnapsEnvironmentOptionsStruct = (0, superstruct_1.type)({
server: (0, superstruct_1.defaulted)((0, superstruct_1.object)({
enabled: (0, superstruct_1.defaulted)((0, superstruct_1.boolean)(), true),
port: (0, superstruct_1.defaulted)((0, superstruct_1.number)(), 0),
root: (0, superstruct_1.defaulted)((0, superstruct_1.string)(), process.cwd()),
}), {}),
});
/**
* Get the environment options. This validates the options, and returns the
* default options if none are provided.
*
* @param testEnvironmentOptions - The test environment options as defined in
* the Jest configuration.
* @returns The environment options.
*/
function getOptions(testEnvironmentOptions) {
return (0, superstruct_1.create)(testEnvironmentOptions, SnapsEnvironmentOptionsStruct);
}
exports.getOptions = getOptions;
//# sourceMappingURL=options.cjs.map