UNPKG

@enspirit/emb

Version:

A replacement for our Makefile-for-monorepos

28 lines (27 loc) 687 B
let context; let contextEmbRoot; export const getContext = () => { return context; }; export const setContext = (ctx) => { context = ctx; contextEmbRoot = process.env.EMB_ROOT; return ctx; }; /** * Check if the context's EMB_ROOT matches the current environment. * Used to detect when tests switch between different example monorepos. */ export const isContextStale = () => { if (!context) { return false; } return contextEmbRoot !== process.env.EMB_ROOT; }; /** * Reset the context. Used in testing to ensure a fresh context for each test suite. */ export const resetContext = () => { context = undefined; contextEmbRoot = undefined; };