testplane
Version:
Tests framework based on mocha and wdio
24 lines • 1.25 kB
JavaScript
;
/*
This functional with global determines if it's running in a browser launched from beforeAll/afterAll hooks.
In this case, it does not delete the state file and passes it to a global variable for Testplane to clean up after all tests and hooks.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.addGlobalFileToRemove = exports.getGlobalFilesToRemove = exports.hasGlobalFilesToRemove = exports.initGlobalFilesToRemove = void 0;
const TESTPLANE_FILES_TO_REMOVE = Symbol.for("testplaneFilesToRemove");
const initGlobalFilesToRemove = () => {
global[TESTPLANE_FILES_TO_REMOVE] = [];
};
exports.initGlobalFilesToRemove = initGlobalFilesToRemove;
const hasGlobalFilesToRemove = () => Array.isArray(global[TESTPLANE_FILES_TO_REMOVE]);
exports.hasGlobalFilesToRemove = hasGlobalFilesToRemove;
const getGlobalFilesToRemove = () => global[TESTPLANE_FILES_TO_REMOVE] || [];
exports.getGlobalFilesToRemove = getGlobalFilesToRemove;
const addGlobalFileToRemove = (path) => {
const filesToRemove = global[TESTPLANE_FILES_TO_REMOVE];
if (filesToRemove) {
filesToRemove.push(path);
}
};
exports.addGlobalFileToRemove = addGlobalFileToRemove;
//# sourceMappingURL=globalFilesToRemove.js.map