@mmisty/cypress-grep
Version:
Filters tests by tags/title using substring or regular expressions (can find dynamic tags)
28 lines (27 loc) • 1.02 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.setPublic = exports.getPublic = void 0;
const exposeApi = () => {
const cy = typeof Cypress !== 'undefined' ? Cypress : undefined;
return typeof (cy === null || cy === void 0 ? void 0 : cy.expose) === 'function'
? cy.expose
: undefined;
};
/**
* Prefer `Cypress.expose()` (Cypress 15.10+). Fall back to `Cypress.env()` for compatibility with `CYPRESS_*`
* variables (while `allowCypressEnv: true` is enabled).
*/
const getPublic = (key) => {
const ex = exposeApi();
const viaExpose = ex === null || ex === void 0 ? void 0 : ex(key);
if (viaExpose !== undefined)
return viaExpose;
return undefined;
};
exports.getPublic = getPublic;
/** Write public config. Mirrors to both `expose` and `env` while env is still allowed. */
const setPublic = (key, value) => {
const ex = exposeApi();
ex === null || ex === void 0 ? void 0 : ex(key, value);
};
exports.setPublic = setPublic;