@metamask/snaps-jest
Version:
A Jest preset for end-to-end testing MetaMask Snaps, including a Jest environment, and a set of Jest matchers
20 lines • 759 B
JavaScript
import { boolean, create, defaulted, number, object, string, type } from "@metamask/superstruct";
const SnapsEnvironmentOptionsStruct = type({
server: defaulted(object({
enabled: defaulted(boolean(), true),
port: defaulted(number(), 0),
root: defaulted(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.
*/
export function getOptions(testEnvironmentOptions) {
return create(testEnvironmentOptions, SnapsEnvironmentOptionsStruct);
}
//# sourceMappingURL=options.mjs.map