console-fail-test
Version:
Gently fails test runs if the console was used during them. 📢
46 lines • 1.79 kB
JavaScript
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var ava_exports = {};
__export(ava_exports, {
selectAvaEnvironment: () => selectAvaEnvironment
});
module.exports = __toCommonJS(ava_exports);
const isAva = (testFramework) => {
return typeof testFramework !== "undefined" && typeof testFramework.afterEach !== "undefined" && typeof testFramework.beforeEach !== "undefined" && typeof testFramework.failing !== "undefined" && typeof testFramework.meta === "object" && typeof testFramework.meta.file === "string" && typeof testFramework.serial !== "undefined" && typeof testFramework.serial.cb !== "undefined";
};
const selectAvaEnvironment = ({
testFramework
}) => {
if (!isAva(testFramework)) {
return void 0;
}
return {
afterEach: (callback) => {
testFramework.afterEach(() => {
callback();
});
},
beforeEach: testFramework.beforeEach
};
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
selectAvaEnvironment
});
//# sourceMappingURL=ava.cjs.map
;