/**
 * Minified by jsDelivr using Terser v5.37.0.
 * Original file: /npm/nodeunit-b@4.0.0/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
var fs=require("fs"),path=require("path");vm=require("vm");var jsdom=require("jsdom"),_=require("underscore"),constants=require("./constants"),extractMeta=function(t){return _(t).defaults(constants.METADEFAULTS)},b=function(t){var n=(t=extractMeta(t)).setUp,e=t.tearDown,r=t.injects,i=b.injects,o=t.provide;return t.syntaxCheck&&_(i).each((function(t){if(!fs.existsSync(t))throw"Local file does not exist: "+t;var n=fs.readFileSync(t).toString();try{vm.createScript(n)}catch(n){throw"Syntax error in local file: "+t+": "+n}})),t.setUp=function(e){var o=this;jsdom.env(t.html,_(i).union(r),(function(t,r){if(t)throw"JSDom error: "+t;o.window=r,n.call(o,e,r,b)}))},_(t).chain().functions().filter((function(t){return t.match(/^test/i)})).each((function(n){var e=t[n];t[n]=function(t){var n=this.window,r=[t,n],i=o.map((function(t){return n[t]}));return e.apply(this,r.concat(i))}})),t.tearDown=function(t){e.call(this,t,this.window,b)},t};_(b).extend({root:constants.injectRoot,setInjectRoot:function(){return this.root=path.join.apply(path,_(arguments).toArray()),this},injects:[],inject:function(t){return _(t).isString()&&(t=[t]),_(t).each(function(t){t.match(new RegExp("^"+path.sep))||(t=path.join(b.root,t)),this.injects.push(t)}.bind(this)),this}}),module.exports=b;
//# sourceMappingURL=/sm/2491efbfd0b1f1aca08debd2148c27e3182860d6e67821434410d6233f6ca4b7.map