UNPKG

@flopflip/cypress-plugin

Version:

A plugin for Cypress change feature toggles in Cypress runs

25 lines (24 loc) 1.07 kB
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" }); //#region src/plugin.ts const FLOPFLIP_GLOBAL = "__flopflip__"; const addCommands = (options) => { Cypress.Commands.add("updateFeatureFlags", (flags) => cy.window().its(FLOPFLIP_GLOBAL).then((flopFlipGlobal) => { const flopflipAdapterGlobal = flopFlipGlobal[options.adapterId]; if (!flopflipAdapterGlobal) throw new Error("@flopflip/cypress: namespace or adapter of the passed id does not exist. Make sure you use one and the specified adapter."); Cypress.log({ name: "updateFeatureFlags", message: "Updating @flopflip feature flags.", consoleProps: () => ({ flags }) }); flopflipAdapterGlobal === null || flopflipAdapterGlobal === void 0 || flopflipAdapterGlobal.updateFlags(flags, { unsubscribeFlags: true }); })); }; const install = (_on) => {}; //#endregion //#region src/index.ts const version = "__@FLOPFLIP/VERSION_OF_RELEASE__"; //#endregion exports.addCommands = addCommands; exports.install = install; exports.version = version; //# sourceMappingURL=index.cjs.map