e2ed
Version:
E2E testing framework over Playwright
25 lines (24 loc) • 868 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getStepsStackStorage = void 0;
const node_async_hooks_1 = require("node:async_hooks");
const useContext_1 = require("../useContext");
/**
* Raw get and set (maybe `undefined`) of test steps stack storage.
* @internal
*/
const [getRawStepsStackStorage, setRawStepsStackStorage] = (0, useContext_1.useContext)();
/**
* Get always defined test steps stack storage.
* @internal
*/
const getStepsStackStorage = () => {
const maybeStepsStackStorage = getRawStepsStackStorage();
if (maybeStepsStackStorage !== undefined) {
return maybeStepsStackStorage;
}
const stepsStackStorage = new node_async_hooks_1.AsyncLocalStorage();
setRawStepsStackStorage(stepsStackStorage);
return stepsStackStorage;
};
exports.getStepsStackStorage = getStepsStackStorage;