@sarj/eslint-plugin 19.0.0 → 19.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,8 @@
1
+ import {createRequire as sarjCreateRequire} from "node:module";const require=sarjCreateRequire(import.meta.url);
2
+ var Hc=Object.defineProperty;var qc=(e,t)=>{for(var r in t)Hc(e,r,{get:t[r],enumerable:!0})};var Mr={};qc(Mr,{"assertion-arguments":()=>ks,"consistent-assert-style":()=>Rs,"consistent-assert-throws-callback-style":()=>_s,"consistent-modifier-style":()=>Ls,"consistent-test-context-name":()=>Bs,"consistent-test-filename":()=>qs,"consistent-test-it":()=>Vs,"hooks-order":()=>$s,"max-assertions":()=>Ks,"max-nested-describe":()=>Xs,"no-assert-in-describe":()=>Js,"no-assert-in-hook":()=>Zs,"no-assert-match-string":()=>sn,"no-assert-throws-async":()=>an,"no-assert-throws-call":()=>pn,"no-assert-throws-multiple-statements":()=>mn,"no-assert-throws-string":()=>yn,"no-async-describe":()=>En,"no-async-fn-without-await":()=>xn,"no-callback-and-promise":()=>Cn,"no-commented-tests":()=>vn,"no-compound-assertion":()=>An,"no-conditional-assertion":()=>jn,"no-conditional-in-test":()=>Mn,"no-conditional-tests":()=>_n,"no-conflicting-modifiers":()=>Fn,"no-constant-assertion":()=>Gn,"no-done-callback":()=>Hn,"no-duplicate-assertions":()=>Un,"no-duplicate-hooks":()=>Wn,"no-duplicate-mock-timers-enable":()=>zn,"no-duplicate-plan":()=>Jn,"no-expect-failure-without-reason":()=>Zn,"no-export":()=>to,"no-identical-assertion-arguments":()=>oo,"no-identical-title":()=>ao,"no-import-test-files":()=>lo,"no-incorrect-deep-equal":()=>po,"no-incorrect-strict-equal":()=>go,"no-late-test-activity":()=>Bo,"no-loop-static-title":()=>qo,"no-misused-concurrency":()=>Vo,"no-misused-context-hook":()=>zo,"no-mock-module-after-import":()=>Yo,"no-mock-timers-destructured-import":()=>ei,"no-nested-tests":()=>ri,"no-only-test":()=>si,"no-parent-test-context":()=>li,"no-process-chdir-in-test":()=>fi,"no-process-env-mutation":()=>yi,"no-process-exit-in-test":()=>Ei,"no-skip-test":()=>Si,"no-skip-without-reason":()=>ki,"no-skip-without-return":()=>vi,"no-sleep-in-test":()=>Pi,"no-snapshot-in-loop":()=>_i,"no-standalone-assert":()=>Fi,"no-test-global-configuration":()=>Ui,"no-test-inside-hook":()=>Wi,"no-test-return-statement":()=>zi,"no-todo-test":()=>Xi,"no-unawaited-promise-assertion":()=>Lo,"no-unawaited-rejects":()=>Yi,"no-unawaited-subtest":()=>Qi,"no-unknown-test-options":()=>ea,"no-unneeded-async-rejects-callback":()=>oa,"no-useless-assertion":()=>aa,"prefer-assert-match":()=>ma,"prefer-assert-throws":()=>ya,"prefer-async-await":()=>ha,"prefer-context-mock":()=>Sa,"prefer-diagnostic":()=>ka,"prefer-equality-assertion":()=>va,"prefer-hooks-on-top":()=>wa,"prefer-lowercase-title":()=>Ra,"prefer-mock-accessor":()=>Pa,"prefer-mock-call-count":()=>Da,"prefer-mock-method":()=>La,"prefer-strict-assert":()=>Ha,"prefer-test-context-assert":()=>Wa,"prefer-todo":()=>Ya,"require-assertion":()=>Za,"require-await-concurrent-subtests":()=>rc,"require-context-assert-with-plan":()=>nc,"require-hook":()=>ac,"require-mock-timers-advance":()=>uc,"require-mock-timers-apis":()=>mc,"require-throws-expectation":()=>dc,"require-throws-validator-return-true":()=>hc,"require-top-level-describe":()=>bc,"test-title":()=>Ic,"test-title-format":()=>kc,"valid-describe-callback":()=>wc,"valid-test-tags":()=>Fc});var _t={ArrayExpression:["elements"],ArrayPattern:["elements"],ArrowFunctionExpression:["params","body"],AssignmentExpression:["left","right"],AssignmentPattern:["left","right"],AwaitExpression:["argument"],BinaryExpression:["left","right"],BlockStatement:["body"],BreakStatement:["label"],CallExpression:["callee","arguments"],CatchClause:["param","body"],ChainExpression:["expression"],ClassBody:["body"],ClassDeclaration:["id","superClass","body"],ClassExpression:["id","superClass","body"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],DebuggerStatement:[],DoWhileStatement:["body","test"],EmptyStatement:[],ExperimentalRestProperty:["argument"],ExperimentalSpreadProperty:["argument"],ExportAllDeclaration:["exported","source"],ExportDefaultDeclaration:["declaration"],ExportNamedDeclaration:["declaration","specifiers","source"],ExportSpecifier:["exported","local"],ExpressionStatement:["expression"],ForInStatement:["left","right","body"],ForOfStatement:["left","right","body"],ForStatement:["init","test","update","body"],FunctionDeclaration:["id","params","body"],FunctionExpression:["id","params","body"],Identifier:[],IfStatement:["test","consequent","alternate"],ImportDeclaration:["specifiers","source"],ImportDefaultSpecifier:["local"],ImportExpression:["source"],ImportNamespaceSpecifier:["local"],ImportSpecifier:["imported","local"],JSXAttribute:["name","value"],JSXClosingElement:["name"],JSXClosingFragment:[],JSXElement:["openingElement","children","closingElement"],JSXEmptyExpression:[],JSXExpressionContainer:["expression"],JSXFragment:["openingFragment","children","closingFragment"],JSXIdentifier:[],JSXMemberExpression:["object","property"],JSXNamespacedName:["namespace","name"],JSXOpeningElement:["name","attributes"],JSXOpeningFragment:[],JSXSpreadAttribute:["argument"],JSXSpreadChild:["expression"],JSXText:[],LabeledStatement:["label","body"],Literal:[],LogicalExpression:["left","right"],MemberExpression:["object","property"],MetaProperty:["meta","property"],MethodDefinition:["key","value"],NewExpression:["callee","arguments"],ObjectExpression:["properties"],ObjectPattern:["properties"],PrivateIdentifier:[],Program:["body"],Property:["key","value"],PropertyDefinition:["key","value"],RestElement:["argument"],ReturnStatement:["argument"],SequenceExpression:["expressions"],SpreadElement:["argument"],StaticBlock:["body"],Super:[],SwitchCase:["test","consequent"],SwitchStatement:["discriminant","cases"],TaggedTemplateExpression:["tag","quasi"],TemplateElement:[],TemplateLiteral:["quasis","expressions"],ThisExpression:[],ThrowStatement:["argument"],TryStatement:["block","handler","finalizer"],UnaryExpression:["argument"],UpdateExpression:["argument"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],WhileStatement:["test","body"],WithStatement:["object","body"],YieldExpression:["argument"]},Uc=Object.keys(_t);for(let e of Uc)Object.freeze(_t[e]);Object.freeze(_t);var Wc=new Set(["parent","leadingComments","trailingComments"]);function $c(e){return!Wc.has(e)&&e[0]!=="_"}function $r(e){return Object.keys(e).filter($c)}function Kc(e,t){let r=t.range[0],s=e,n=!1;do{n=!1;for(let o of s.childScopes){let i=o.block.range;if(i[0]<=r&&r<i[1]){s=o,n=!0;break}}}while(n);return s}function C(e,t){let r="",s=e;for(typeof t=="string"?r=t:(r=t.name,s=Kc(s,t));s!=null;){let n=s.set.get(r);if(n!=null)return n;s=s.upper}return null}function ce(e){return t=>!e(t)}function ue(e,t){return e.type==="Punctuator"&&e.value===t}function zc(e){return ue(e,"=>")}function Lt(e){return ue(e,",")}function Xc(e){return ue(e,";")}function Yc(e){return ue(e,":")}function Be(e){return ue(e,"(")}function Gt(e){return ue(e,")")}function Jc(e){return ue(e,"[")}function Qc(e){return ue(e,"]")}function Zc(e){return ue(e,"{")}function el(e){return ue(e,"}")}function tl(e){return["Block","Line","Shebang"].includes(e.type)}var ib=ce(zc),ab=ce(Lt),cb=ce(Xc),lb=ce(Yc),ub=ce(Be),pb=ce(Gt),fb=ce(Jc),mb=ce(Qc),db=ce(Zc),gb=ce(el),yb=ce(tl);var Qr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{},rl=Object.freeze(new Set(["Array","ArrayBuffer","BigInt","BigInt64Array","BigUint64Array","Boolean","DataView","Date","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","Float32Array","Float64Array","Function","Infinity","Int16Array","Int32Array","Int8Array","isFinite","isNaN","isPrototypeOf","JSON","Map","Math","NaN","Number","Object","parseFloat","parseInt","Promise","Proxy","Reflect","RegExp","Set","String","Symbol","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray","undefined","unescape","WeakMap","WeakSet"])),Nt=new Set([Array.isArray,Array.of,Array.prototype.at,Array.prototype.concat,Array.prototype.entries,Array.prototype.every,Array.prototype.filter,Array.prototype.find,Array.prototype.findIndex,Array.prototype.flat,Array.prototype.includes,Array.prototype.indexOf,Array.prototype.join,Array.prototype.keys,Array.prototype.lastIndexOf,Array.prototype.slice,Array.prototype.some,Array.prototype.toString,Array.prototype.values,typeof BigInt=="function"?BigInt:void 0,Boolean,Date,Date.parse,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,escape,isFinite,isNaN,isPrototypeOf,Map,Map.prototype.entries,Map.prototype.get,Map.prototype.has,Map.prototype.keys,Map.prototype.values,...Object.getOwnPropertyNames(Math).filter(e=>e!=="random").map(e=>Math[e]).filter(e=>typeof e=="function"),Number,Number.isFinite,Number.isNaN,Number.parseFloat,Number.parseInt,Number.prototype.toExponential,Number.prototype.toFixed,Number.prototype.toPrecision,Number.prototype.toString,Object,Object.entries,Object.is,Object.isExtensible,Object.isFrozen,Object.isSealed,Object.keys,Object.values,parseFloat,parseInt,RegExp,Set,Set.prototype.entries,Set.prototype.has,Set.prototype.keys,Set.prototype.values,String,String.fromCharCode,String.fromCodePoint,String.raw,String.prototype.at,String.prototype.charAt,String.prototype.charCodeAt,String.prototype.codePointAt,String.prototype.concat,String.prototype.endsWith,String.prototype.includes,String.prototype.indexOf,String.prototype.lastIndexOf,String.prototype.normalize,String.prototype.padEnd,String.prototype.padStart,String.prototype.slice,String.prototype.startsWith,String.prototype.substr,String.prototype.substring,String.prototype.toLowerCase,String.prototype.toString,String.prototype.toUpperCase,String.prototype.trim,String.prototype.trimEnd,String.prototype.trimLeft,String.prototype.trimRight,String.prototype.trimStart,Symbol.for,Symbol.keyFor,unescape].filter(e=>typeof e=="function")),Kr=new Set([Object.freeze,Object.preventExtensions,Object.seal]),sl=[[Map,new Set(["size"])],[RegExp,new Set(["dotAll","flags","global","hasIndices","ignoreCase","multiline","source","sticky","unicode"])],[Set,new Set(["size"])]];function nl(e,t){let r=e;for(;(typeof r=="object"||typeof r=="function")&&r!==null;){let s=Object.getOwnPropertyDescriptor(r,t);if(s)return s;r=Object.getPrototypeOf(r)}return null}function ol(e,t){let r=nl(e,t);return r!=null&&r.get!=null}function Qe(e,t){let r=[];for(let s=0;s<e.length;++s){let n=e[s];if(n==null)r.length=s+1;else if(n.type==="SpreadElement"){let o=G(n.argument,t);if(o==null)return null;r.push(...o.value)}else{let o=G(n,t);if(o==null)return null;r.push(o.value)}}return r}function il(e){return e!=null&&e.defs.length===0&&rl.has(e.name)&&e.name in Qr}function al(e){if(e.defs.length!==1)return!1;let t=e.defs[0];return!!(t.parent&&t.type==="Variable"&&(t.parent.kind==="const"||cl(e)))}function cl(e){let t=e.references,r=t.filter(n=>n.init).length,s=t.filter(n=>n.isReadOnly()).length;return r===1&&s+r===t.length}function ll(e,t){for(let s of e.references){let n=s.identifier;for(;n&&n.parent&&n.parent.type==="MemberExpression";)n=n.parent;if(!(!n||!n.parent)){if(n.parent.type==="AssignmentExpression"&&n.parent.left===n||n.parent.type==="UpdateExpression"&&n.parent.argument===n)return!0;if(n.parent.type==="CallExpression"&&n.parent.callee===n&&n.type==="MemberExpression"){let o=dt(n,t);if(r(o))return!0}}}return!1;function r(s){if(s==null||s.value==null)return!1;let n=s.value;return n==="copyWithin"||n==="fill"||n==="pop"||n==="push"||n==="reverse"||n==="shift"||n==="sort"||n==="splice"||n==="unshift"}}var zr=Object.freeze({ArrayExpression(e,t){let r=Qe(e.elements,t);return r!=null?{value:r}:null},AssignmentExpression(e,t){return e.operator==="="?G(e.right,t):null},BinaryExpression(e,t){if(e.operator==="in"||e.operator==="instanceof")return null;let r=G(e.left,t),s=G(e.right,t);if(r!=null&&s!=null)switch(e.operator){case"==":return{value:r.value==s.value};case"!=":return{value:r.value!=s.value};case"===":return{value:r.value===s.value};case"!==":return{value:r.value!==s.value};case"<":return{value:r.value<s.value};case"<=":return{value:r.value<=s.value};case">":return{value:r.value>s.value};case">=":return{value:r.value>=s.value};case"<<":return{value:r.value<<s.value};case">>":return{value:r.value>>s.value};case">>>":return{value:r.value>>>s.value};case"+":return{value:r.value+s.value};case"-":return{value:r.value-s.value};case"*":return{value:r.value*s.value};case"/":return{value:r.value/s.value};case"%":return{value:r.value%s.value};case"**":return{value:r.value**s.value};case"|":return{value:r.value|s.value};case"^":return{value:r.value^s.value};case"&":return{value:r.value&s.value}}return null},CallExpression(e,t){let r=e.callee,s=Qe(e.arguments,t);if(s!=null)if(r.type==="MemberExpression"){if(r.property.type==="PrivateIdentifier")return null;let n=G(r.object,t);if(n!=null){if(n.value==null&&(n.optional||e.optional))return{value:void 0,optional:!0};let o=dt(r,t);if(o!=null){let i=n.value,a=o.value;if(Nt.has(i[a]))return{value:i[a](...s)};if(Kr.has(i[a]))return{value:s[0]}}}}else{let n=G(r,t);if(n!=null){if(n.value==null&&e.optional)return{value:void 0,optional:!0};let o=n.value;if(Nt.has(o))return{value:o(...s)};if(Kr.has(o))return{value:s[0]}}}return null},ConditionalExpression(e,t){let r=G(e.test,t);return r!=null?r.value?G(e.consequent,t):G(e.alternate,t):null},ExpressionStatement(e,t){return G(e.expression,t)},Identifier(e,t){if(t!=null){let r=C(t,e);if(r!=null){if(il(r))return{value:Qr[r.name]};if(al(r)){let s=r.defs[0];if(s.node.id.type==="Identifier"){let n=G(s.node.init,t);return n&&typeof n.value=="object"&&n.value!==null&&ll(r,t)?null:n}}}}return null},Literal(e){let t=e;return(t.regex!=null||t.bigint!=null)&&t.value==null?null:{value:t.value}},LogicalExpression(e,t){let r=G(e.left,t);if(r!=null){if(e.operator==="||"&&r.value||e.operator==="&&"&&!r.value||e.operator==="??"&&r.value!=null)return r;let s=G(e.right,t);if(s!=null)return s}return null},MemberExpression(e,t){if(e.property.type==="PrivateIdentifier")return null;let r=G(e.object,t);if(r!=null){if(r.value==null&&(r.optional||e.optional))return{value:void 0,optional:!0};let s=dt(e,t);if(s!=null){if(!ol(r.value,s.value))return{value:r.value[s.value]};for(let[n,o]of sl)if(r.value instanceof n&&o.has(s.value))return{value:r.value[s.value]}}}return null},ChainExpression(e,t){let r=G(e.expression,t);return r!=null?{value:r.value}:null},NewExpression(e,t){let r=G(e.callee,t),s=Qe(e.arguments,t);if(r!=null&&s!=null){let n=r.value;if(Nt.has(n))return{value:new n(...s)}}return null},ObjectExpression(e,t){let r={};for(let s of e.properties)if(s.type==="Property"){if(s.kind!=="init")return null;let n=dt(s,t),o=G(s.value,t);if(n==null||o==null)return null;r[n.value]=o.value}else if(s.type==="SpreadElement"||s.type==="ExperimentalSpreadProperty"){let n=G(s.argument,t);if(n==null)return null;Object.assign(r,n.value)}else return null;return{value:r}},SequenceExpression(e,t){let r=e.expressions[e.expressions.length-1];return G(r,t)},TaggedTemplateExpression(e,t){let r=G(e.tag,t),s=Qe(e.quasi.expressions,t);if(r!=null&&s!=null){let n=r.value,o=e.quasi.quasis.map(i=>i.value.cooked);if(o.raw=e.quasi.quasis.map(i=>i.value.raw),n===String.raw)return{value:n(o,...s)}}return null},TemplateLiteral(e,t){let r=Qe(e.expressions,t);if(r!=null){let s=e.quasis[0].value.cooked;for(let n=0;n<r.length;++n)s+=r[n],s+=e.quasis[n+1].value.cooked;return{value:s}}return null},UnaryExpression(e,t){if(e.operator==="delete")return null;if(e.operator==="void")return{value:void 0};let r=G(e.argument,t);if(r!=null)switch(e.operator){case"-":return{value:-r.value};case"+":return{value:+r.value};case"!":return{value:!r.value};case"~":return{value:~r.value};case"typeof":return{value:typeof r.value}}return null},TSAsExpression(e,t){return G(e.expression,t)},TSSatisfiesExpression(e,t){return G(e.expression,t)},TSTypeAssertion(e,t){return G(e.expression,t)},TSNonNullExpression(e,t){return G(e.expression,t)},TSInstantiationExpression(e,t){return G(e.expression,t)}});function G(e,t){return e!=null&&Object.hasOwnProperty.call(zr,e.type)?zr[e.type](e,t):null}function dt(e,t){let r=e.type==="Property"?e.key:e.property;return e.computed?G(r,t):r.type==="Identifier"?{value:r.name}:r.type==="Literal"?r.bigint?{value:r.bigint}:{value:String(r.value)}:null}function B(e,t=null){try{return G(e,t)}catch{return null}}function Ft(e,t=null){if(e&&e.type==="Literal"&&e.value===null){let s=e;if(s.regex)return`/${s.regex.pattern}/${s.regex.flags}`;if(s.bigint)return s.bigint}let r=B(e,t);if(r)try{return String(r.value)}catch{}return null}function Xr(e,t){switch(e.type){case"MemberExpression":return e.computed?Ft(e.property,t):e.property.type==="PrivateIdentifier"?null:e.property.name;case"Property":case"MethodDefinition":case"PropertyDefinition":return e.computed?Ft(e.key,t):e.key.type==="Literal"?String(e.key.value):e.key.type==="PrivateIdentifier"?null:e.key.name}return null}var ul=Object.freeze(new Set(["==","!=","<","<=",">",">=","<<",">>",">>>","+","-","*","/","%","|","^","&","in"])),pl=Object.freeze(new Set(["-","+","!","~"]));function Yr(e){return e!==null&&typeof e=="object"&&typeof e.type=="string"}var hb=Object.freeze(Object.assign(Object.create(null),{$visit(e,t,r){let{type:s}=e;return typeof this[s]=="function"?this[s](e,t,r):this.$visitChildren(e,t,r)},$visitChildren(e,t,r){let{type:s}=e;for(let n of r[s]||$r(e)){let o=e[n];if(Array.isArray(o)){for(let i of o)if(Yr(i)&&this.$visit(i,t,r))return!0}else if(Yr(o)&&this.$visit(o,t,r))return!0}return!1},ArrowFunctionExpression(){return!1},AssignmentExpression(){return!0},AwaitExpression(){return!0},BinaryExpression(e,t,r){return t.considerImplicitTypeConversion&&ul.has(e.operator)&&(e.left.type!=="Literal"||e.right.type!=="Literal")?!0:this.$visitChildren(e,t,r)},CallExpression(){return!0},FunctionExpression(){return!1},ImportExpression(){return!0},MemberExpression(e,t,r){return t.considerGetters||t.considerImplicitTypeConversion&&e.computed&&e.property.type!=="Literal"?!0:this.$visitChildren(e,t,r)},MethodDefinition(e,t,r){return t.considerImplicitTypeConversion&&e.computed&&e.key.type!=="Literal"?!0:this.$visitChildren(e,t,r)},NewExpression(){return!0},Property(e,t,r){return t.considerImplicitTypeConversion&&e.computed&&e.key.type!=="Literal"?!0:this.$visitChildren(e,t,r)},PropertyDefinition(e,t,r){return t.considerImplicitTypeConversion&&e.computed&&e.key.type!=="Literal"?!0:this.$visitChildren(e,t,r)},UnaryExpression(e,t,r){return e.operator==="delete"||t.considerImplicitTypeConversion&&pl.has(e.operator)&&e.argument.type!=="Literal"?!0:this.$visitChildren(e,t,r)},UpdateExpression(){return!0},YieldExpression(){return!0}}));var fl=/^(?:Import|Export(?:All|Default|Named))Declaration$/u;function ml(e){return fl.test(e.type)&&e.source!=null}var we=Function.call.bind(Object.hasOwnProperty),U=Symbol("read"),Ze=Symbol("call"),gt=Symbol("construct"),Zr=Symbol("esm"),dl={require:{[Ze]:!0}};function Jr(e){return e==null||e.defs.length!==0||e.references.some(t=>t.isWrite())}function gl(e){let t=e.parent;if(t)switch(t.type){case"ConditionalExpression":return t.consequent===e||t.alternate===e;case"LogicalExpression":return!0;case"SequenceExpression":return t.expressions[t.expressions.length-1]===e;case"ChainExpression":return!0;case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":case"TSNonNullExpression":case"TSInstantiationExpression":return!0;default:return!1}return!1}var Ge=class{constructor(t,r={}){let{mode:s="strict",globalObjectNames:n=["global","globalThis","self","window"]}=r;this.variableStack=[],this.globalScope=t,this.mode=s,this.globalObjectNames=n.slice(0)}*iterateGlobalReferences(t){for(let r of Object.keys(t)){let s=t[r],n=[r],o=this.globalScope.set.get(r);Jr(o)||(yield*this._iterateVariableReferences(o,n,s,!0))}for(let r of this.globalObjectNames){let s=[],n=this.globalScope.set.get(r);Jr(n)||(yield*this._iterateVariableReferences(n,s,t,!1))}}*iterateCjsReferences(t){for(let{node:r}of this.iterateGlobalReferences(dl)){let s=Ft(r.arguments[0]);if(s==null||!we(t,s))continue;let n=t[s],o=[s];n[U]&&(yield{node:r,path:o,type:U,info:n[U]}),yield*this._iteratePropertyReferences(r,o,n)}}*iterateEsmReferences(t){let r=this.globalScope.block;for(let s of r.body){if(!ml(s))continue;let n=s.source.value;if(!we(t,n))continue;let o=t[n],i=[n];if(o[U]&&(yield{node:s,path:i,type:U,info:o[U]}),s.type==="ExportAllDeclaration")for(let a of Object.keys(o)){let c=o[a];c[U]&&(yield{node:s,path:i.concat(a),type:U,info:c[U]})}else for(let a of s.specifiers){let c=we(o,Zr),l=this._iterateImportReferences(a,i,c?o:this.mode==="legacy"?{default:o,...o}:{default:o});if(c)yield*l;else for(let u of l)u.path=u.path.filter(yl),(u.path.length>=2||u.type!==U)&&(yield u)}}}*iteratePropertyReferences(t,r){yield*this._iteratePropertyReferences(t,[],r)}*_iterateVariableReferences(t,r,s,n){if(!this.variableStack.includes(t)){this.variableStack.push(t);try{for(let o of t.references){if(!o.isRead())continue;let i=o.identifier;n&&s[U]&&(yield{node:i,path:r,type:U,info:s[U]}),yield*this._iteratePropertyReferences(i,r,s)}}finally{this.variableStack.pop()}}}*_iteratePropertyReferences(t,r,s){let n=t;for(;gl(n);)n=n.parent;let o=n.parent;if(o){if(o.type==="MemberExpression"){if(o.object===n){let i=Xr(o);if(i==null||!we(s,i))return;r=r.concat(i);let a=s[i];a[U]&&(yield{node:o,path:r,type:U,info:a[U]}),yield*this._iteratePropertyReferences(o,r,a)}return}if(o.type==="CallExpression"){o.callee===n&&s[Ze]&&(yield{node:o,path:r,type:Ze,info:s[Ze]});return}if(o.type==="NewExpression"){o.callee===n&&s[gt]&&(yield{node:o,path:r,type:gt,info:s[gt]});return}if(o.type==="AssignmentExpression"){o.right===n&&(yield*this._iterateLhsReferences(o.left,r,s),yield*this._iteratePropertyReferences(o,r,s));return}if(o.type==="AssignmentPattern"){o.right===n&&(yield*this._iterateLhsReferences(o.left,r,s));return}o.type==="VariableDeclarator"&&o.init===n&&(yield*this._iterateLhsReferences(o.id,r,s))}}*_iterateLhsReferences(t,r,s){if(t.type==="Identifier"){let n=C(this.globalScope,t);n!=null&&(yield*this._iterateVariableReferences(n,r,s,!1));return}if(t.type==="ObjectPattern"){for(let n of t.properties){let o=Xr(n);if(o==null||!we(s,o))continue;let i=r.concat(o),a=s[o];a[U]&&(yield{node:n,path:i,type:U,info:a[U]}),yield*this._iterateLhsReferences(n.value,i,a)}return}t.type==="AssignmentPattern"&&(yield*this._iterateLhsReferences(t.left,r,s))}*_iterateImportReferences(t,r,s){let n=t.type;if(n==="ImportSpecifier"||n==="ImportDefaultSpecifier"){let o=n==="ImportDefaultSpecifier"?"default":t.imported.type==="Identifier"?t.imported.name:t.imported.value;if(!we(s,o))return;r=r.concat(o);let i=s[o];i[U]&&(yield{node:t,path:r,type:U,info:i[U]}),yield*this._iterateVariableReferences(C(this.globalScope,t.local),r,i,!1);return}if(n==="ImportNamespaceSpecifier"){yield*this._iterateVariableReferences(C(this.globalScope,t.local),r,s,!1);return}if(n==="ExportSpecifier"){let o=t.local.type==="Identifier"?t.local.name:t.local.value;if(!we(s,o))return;r=r.concat(o);let i=s[o];i[U]&&(yield{node:t,path:r,type:U,info:i[U]})}}};Ge.READ=U;Ge.CALL=Ze;Ge.CONSTRUCT=gt;Ge.ESM=Zr;function yl(e,t){return!(t===1&&e==="default")}var hl=["FunctionDeclaration","FunctionExpression","ArrowFunctionExpression"],j=hl;function I(e){return j.includes(e?.type)}var El=new Set(["TSAsExpression","TSInstantiationExpression","TSSatisfiesExpression","TSNonNullExpression","TSTypeAssertion"]),Ae=e=>El.has(e?.type),Sl=new Set(["TSAsExpression","TSSatisfiesExpression","TSTypeAssertion"]),es=e=>Sl.has(e?.type);function m(e){for(;Ae(e);)e=e.expression;return e}var ne=e=>e?.type==="ChainExpression"||Ae(e);function oe(e){for(;ne(e);)e=e.parent;return e}function S(e){for(;ne(e);)e=e.expression;return e}function Z(e){for(;ne(e.parent);)e=e.parent;return e}function $(e){for(;e?.type==="ChainExpression";)e=e.expression;let t;switch(e?.type){case"MemberExpression":{t=e.property;break}case"Property":case"MethodDefinition":{t=e.key;break}}if(t){if(t.type==="Identifier"&&!e.computed)return t.name;let r=B(t);return r?String(r.value):void 0}}function bl(e,t){return e.regex||t.regex?!!(e.regex&&t.regex&&e.regex.pattern===t.regex.pattern&&e.regex.flags===t.regex.flags):e.bigint||t.bigint?e.bigint===t.bigint:e.value===t.value}function Re(e,t){if(e=S(e),t=S(t),e.type!==t.type)return!1;switch(e.type){case"Super":case"ThisExpression":return!0;case"Identifier":case"PrivateIdentifier":return e.name===t.name;case"Literal":return bl(e,t);case"MemberExpression":{if(e.optional!==t.optional)return!1;let r=$(e);return r!==void 0?Re(e.object,t.object)&&r===$(t):e.computed===t.computed&&Re(e.object,t.object)&&Re(e.property,t.property)}default:return!1}}var le=new Set(["test","it"]),xl=new Set([...le,"expectFailure"]),as=new Set(["only","skip","todo"]),cs=new Set(["describe","suite"]),Ce=new Set(["before","after","beforeEach","afterEach"]),Ut=new Set([...xl,...cs,...Ce,"getTestContext","mock"]),ls=new Set(["assert","snapshot"]);var _=new Set(["only","skip","todo"]);var kl="node:test",Vt=new Set(["node:assert","node:assert/strict","assert","assert/strict"]),ts=new WeakMap;function d(e){let{ast:t}=e.sourceCode,r=ts.get(t);if(r)return r;let s=Il(e);return ts.set(t,s),s}function Cl(e){if(e===kl)return"test";if(Vt.has(e))return"assert"}function yt(e,t,r,s){r===void 0?e.assertNamespace.add(t):e.assertNamed.set(t,r),s&&e.strictAssertLocals.add(t)}function X(e){return e.imported.type==="Identifier"?e.imported.name:typeof e.imported.value=="string"?e.imported.value:void 0}function Tl(e,t){if(e.importKind==="type")return;let{value:r}=e.source,s=Cl(r);if(!s)return;let n=r.endsWith("/strict");for(let o of e.specifiers){if(o.importKind==="type")continue;let i=o.local.name;if(o.type==="ImportSpecifier"){let a=X(o);if(!a)continue;if(s==="assert"){a==="strict"?yt(t,i,void 0,!0):a==="default"?yt(t,i,void 0,n):yt(t,i,a,n);continue}a==="default"?(t.locals.set(i,"test"),t.namespaces.add(i)):as.has(a)?t.testModifierLocals.set(i,a):Ut.has(a)?t.locals.set(i,a):ls.has(a)&&t.configurationLocals.set(i,a)}else s==="assert"?yt(t,i,void 0,n):(o.type==="ImportDefaultSpecifier"&&t.locals.set(i,"test"),t.namespaces.add(i))}}function Il(e){let t={sourceCode:e.sourceCode,locals:new Map,namespaces:new Set,configurationLocals:new Map,testModifierLocals:new Map,assertNamespace:new Set,assertNamed:new Map,strictAssertLocals:new Set};for(let a of e.sourceCode.ast.body)a.type==="ImportDeclaration"&&typeof a.source.value=="string"&&Tl(a,t);let{locals:r,assertNamespace:s,assertNamed:n}=t,o=r.size>0||t.namespaces.size>0||t.testModifierLocals.size>0,i=s.size>0||n.size>0;return{...t,sourceCode:e.sourceCode,mockLocals:new Set([...r].filter(([,a])=>a==="mock").map(([a])=>a)),getTestContextName:[...r].find(([,a])=>a==="getTestContext")?.[0],isTestFile:o,hasAssert:i,isAssertOrTestFile:i||o}}function et(e,t){return C(t.sourceCode.getScope(e),e.name)}function Wt(e,t,r){return r.sourceCode.getDeclaredVariables(t).find(s=>s.identifiers.includes(e))}function be(e,t){return et(e,t)?.defs.some(r=>r.type==="ImportBinding")??!1}function J(e,t){if(e=m(e),e.type==="Identifier")return t.mockLocals.has(e.name)&&be(e,t);if(e.type!=="MemberExpression"||e.computed||e.property.type!=="Identifier"||e.property.name!=="mock")return!1;let r=m(e.object);return r.type==="Identifier"&&(t.namespaces.has(r.name)||le.has(t.locals.get(r.name)))&&be(r,t)}function M(e,t){if(e.type!=="CallExpression")return!1;let r=ee(e.callee);if(!r||!be(r.root,t))return!1;let{root:s,members:n}=r,o=t.namespaces.has(s.name)||le.has(t.locals.get(s.name)),i=n.length===2&&(le.has(n[0].name)||n[0].name==="default")&&n[1].name==="getTestContext"&&t.namespaces.has(s.name);return t.locals.get(s.name)==="getTestContext"&&n.length===0||n.length===1&&n[0].name==="getTestContext"&&o||i}function vl(e){let t=[];for(;e;){if(e=m(e),e.type==="ChainExpression"){e=e.expression;continue}if(e.type==="Identifier")return{root:e,members:t};if(e.type==="MemberExpression"&&!e.computed&&e.property.type==="Identifier"){t.unshift(e.property),e=e.object;continue}return}}var rs=Symbol("calleeChain"),ss=Symbol("no chain");function ee(e){if(!e)return;let t=e[rs];if(t!==void 0)return t===ss?void 0:t;let r=vl(e);return e[rs]=r??ss,r}function wl(e,t){return t.locals.has(e)||t.namespaces.has(e)||t.testModifierLocals.has(e)}function Al(e){if(le.has(e))return"test";if(cs.has(e))return"suite";if(Ce.has(e))return"hook"}function ns(e,t){let[r,...s]=t;if(r&&Ut.has(r.name)){let n=r.name==="expectFailure"||s[0]?.name==="expectFailure";return{name:r.name==="expectFailure"?e:r.name,modifiers:n?s.slice(1):s,hasExpectedFailure:n}}return{name:e,modifiers:t,hasExpectedFailure:!1}}function Rl(e,t,r){if(r.namespaces.has(e.name)&&!r.locals.has(e.name)&&t?.name==="default")return"test";if(le.has(t?.name)&&(r.namespaces.has(e.name)||le.has(r.locals.get(e.name))))return t.name}function Ol(e,t,r){let s=t[0];if(as.has(s?.name)&&t.length===1&&r.namespaces.has(e.name)&&!r.locals.has(e.name))return{name:"test",modifiers:[s],hasExpectedFailure:!1,hasStandaloneModifier:!0};let n=Rl(e,s,r);if(n)return ns(n,t.slice(1));if(s&&Ut.has(s.name)&&(r.namespaces.has(e.name)||le.has(r.locals.get(e.name))))return ns(r.locals.get(e.name)??"test",t)}var jl=Symbol("parsedTestCall"),Pl=Symbol("parsedAssertionCall"),us=(e,t)=>(r,s)=>{if(r.type!=="CallExpression")return;let n=r[e];if(n!==void 0&&n.node===r&&n.imports===s)return n.result;let o=t(r,s);return r[e]={node:r,imports:s,result:o},o},b=us(jl,(e,t)=>{let r=ee(e.callee);if(!r)return;let{root:s,members:n}=r;if(!wl(s.name,t)||!be(s,t))return;let o,i=t.testModifierLocals.get(s.name);if(i&&n.length===0?o={name:"test",modifiers:[s.name===i?s:{...s,name:i}],hasExpectedFailure:!1,hasStandaloneModifier:!0}:o=Ol(s,n,t),!o&&t.locals.has(s.name)){let c=t.locals.get(s.name);c==="expectFailure"?o={name:"test",modifiers:[],hasExpectedFailure:!0}:o={name:c,modifiers:n[0]?.name==="expectFailure"?n.slice(1):n,hasExpectedFailure:n[0]?.name==="expectFailure"}}if(!o||o.modifiers.some(c=>ls.has(c.name)))return;let a=Al(o.name);if(a)return{...o,kind:a}}),ps=(e,t)=>e.find(r=>r.name===t);function K(e){if(e.type!=="CallExpression")return;let t=ee(e.callee);if(!t||t.members[0]?.name!=="test")return;let{members:r}=t;for(let s=1;s<r.length;s+=1)if(!_.has(r[s].name))return;return t.root}function He(e,t){let r=m(e.callee);return r?.type==="MemberExpression"&&!r.computed&&r.property.type==="Identifier"&&r.property.name==="test"&&M(m(r.object),t)}function qe(e,t){return K(e)!==void 0||He(e,t)}function xe(e){let t=m(e.callee);return t?.type==="MemberExpression"&&!t.computed&&t.property.type==="Identifier"&&Ce.has(t.property.name)?t.property.name:void 0}function N(e,t){return xe(e)===void 0?!1:t(m(m(e.callee).object))}function Oe(e){let{parent:t}=e;for(;Ae(t);){let{parent:r}=t;t=r}if(t?.type==="Property"&&t.parent?.type==="ObjectExpression")for(t=t.parent.parent;Ae(t);)t=t.parent;return t?.type==="CallExpression"?t:void 0}function $t(e){if(e?.type==="Identifier")return e;if(e?.type==="AssignmentPattern"&&e.left.type==="Identifier")return e.left}var fs=e=>e.type==="Identifier"&&e.name==="this";function Ue(e,t){return(e??[]).filter(r=>!fs(r))[t]}function q(e){let t=Ue(e,0);return t&&$t(t)}var Et=Symbol("not a destructured assert binding"),Bt=Symbol("the destructured assert object");function y(e,{trackHooks:t=!1}={}){let r=[],s=[],n=[],o=[],i=[],a=x=>x!==void 0&&s.includes(x)&&x.defs.length===1&&x.defs[0].type==="Parameter",c={sourceCode:e.sourceCode},l=x=>x==="test"||t&&x==="hook",u=x=>x?.type==="Identifier"&&(s.length>0&&a(et(x,e))||l(Ht(x,e,c))),p=x=>{let A=K(x);return A?u(A)||Ht(A,e,c)!==void 0:qe(x,e)},f=x=>{if(x?.type!=="Identifier")return Et;let A=et(x,e);if(!A)return Et;for(let H of o)if(H.has(A))return H.get(A)??Bt;return Bl(A,e,c,l)},g=x=>u(x)||M(m(x),e),h=(x,A)=>t&&(A?.kind==="hook"&&A.modifiers.length===0||N(x,g)),k=x=>x?.kind==="test"&&x.modifiers.every(A=>_.has(A.name));return{isSubtestCall:p,isContextReceiver:g,isContextIdentifier:u,isContextNameInScope:(x,A)=>s.length===0||x===void 0?!1:a(C(e.sourceCode.getScope(A),x)),current:()=>r.at(-1),currentContextVariable:()=>s.at(-1),currentCallback:()=>n.at(-1),isTrackedCallback:x=>n.includes(x),assertBinding(){return{getMethodName(x){let A=f(x);return typeof A=="string"?A:void 0},isAssertObject:x=>f(x)===Bt}},update(x){let A=b(x,e),H=h(x,A);if(!H&&!k(A)&&!p(x))return;let z=H?V(x):v(x,e);if(z){let Ee=q(z.params);r.push(Ee?.name),s.push(Ee?Wt(Ee,z,e):void 0),o.push(We(z,e)),n.push(z),i.push(x)}},leave(x){i.at(-1)===x&&(i.pop(),r.pop(),s.pop(),o.pop(),n.pop())}}}function R(e,t,r){let s=te(e,t);return s?s.contextReceiver!==void 0&&!r.isContextIdentifier(s.contextReceiver)&&!M(s.contextReceiver,t)?void 0:s:Kt(e,r.assertBinding())}function Kt(e,t){let r=m(e.callee);if(r.type==="Identifier"){let n=t.getMethodName(r);return n===void 0||n==="strict"?void 0:{method:n,methodNode:r,isStrict:!1}}if(r.type!=="MemberExpression"||r.computed||r.property.type!=="Identifier")return;let s=m(r.object);return t.isAssertObject(s)&&r.property.name!=="strict"?{method:r.property.name,methodNode:r.property,isStrict:!1}:void 0}function Ve(){let e=new Set,t=0;return{get depth(){return t},enterSuite(r){t+=1,e.add(r)},exitSuite(r){e.has(r)&&(e.delete(r),t-=1)}}}function tt(e){return e!==void 0&&e.defs.length===1&&e.defs[0].type==="Parameter"}function D(e,t,r){if(!I(e))return;let s=e.parent?.type==="VariableDeclarator"&&e.parent.init===e?e.parent:void 0,n=e.type==="FunctionDeclaration"?e.id:s?.id;if(n?.type!=="Identifier")return;let o=l=>gs(l,r,t),i=Wt(n,s??e,r),[a,c]=t.sourceCode.getRange(e);for(let l of i?.references??[]){let[u]=t.sourceCode.getRange(l.identifier);if(u>=a&&u<c)continue;let p=Dl(l.identifier,r,o);if(p&&Ml(p,t,r,o)===e)return p}}function Ml(e,t,r,s){return b(e,r)===void 0&&N(e,s)?pe(e.arguments[0],t):ie(e,t,r)}function ms(e,t,r){return D(e,t,r)!==void 0}function Dl(e,t,r){let s=Z(e),{parent:n}=s;if(n?.type==="Property"&&n.value===s){if($(n)!=="fn"||(n=Z(n.parent).parent,n?.type!=="CallExpression"))return}else if(n?.type!=="CallExpression"||!n.arguments.includes(s))return;return b(n,t)!==void 0||qe(n,t)||!!r&&N(n,r)?n:void 0}function rt(e,t){return e.getTestContextName?C(e.sourceCode.getScope(t),e.getTestContextName)?.defs.some(s=>s.type==="ImportBinding")??!1:!1}function _l(e,t){return e&&=m(e),e&&(e.type==="Literal"&&typeof e.value=="string"||e.type==="TemplateLiteral"||typeof B(e,t.sourceCode.getScope(e))?.value=="string")?e:void 0}function fe(e,t){let r=zt(e);return r&&_l(r,t)}function Nl(e){return e=m(e),!I(e)&&e.type!=="Literal"&&e.type!=="TemplateLiteral"&&e.type!=="UnaryExpression"&&!(e.type==="Identifier"&&(e.name==="undefined"||e.name==="NaN"))}function zt(e){let t=e.arguments[0]&&m(e.arguments[0]),r=t?.type==="ObjectExpression",s=r?t:F(e);if(!s){if(I(t))return;let[,o,i]=e.arguments;return(i!==void 0||o?.type==="SpreadElement")&&Nl(o)?void 0:t}let n=W(s,"name");if(!(!n&&s.properties.some(o=>o.type==="SpreadElement"||o.computed&&$(o)===void 0))&&!(!n&&r)&&!(!n&&I(t)))return n?m(n.value):t}function me(e,t){if(!e)return;let{sourceCode:r}=t;if(e=m(e),e.type==="Literal"&&typeof e.value=="string")return e.value;if(e.type==="TemplateLiteral"&&e.expressions.length===0)return e.quasis[0].value.cooked??void 0;let s=B(e,r.getScope(e));return typeof s?.value=="string"?s.value:void 0}function V(e){let t=m(e.arguments[0]);if(t&&I(t))return t}function Xt(e){return V(e)!==void 0}function ie(e,t,r){if(b(e,r)?.kind==="hook")return pe(e.arguments[0],t);let n=Xt(e)?void 0:W(F(e),"fn");if(n)return pe(n.value,t);for(let o of e.arguments){let i=pe(o,t);if(i)return i}}function pe(e,t){return e&&=m(e),I(e)?e:e?.type==="Identifier"?Fl(e,t):void 0}function Fl(e,t){let r=C(t.sourceCode.getScope(e),e),s=r?.defs.filter(i=>i.node?.type!=="TSDeclareFunction")??[];if(s.length!==1||r.references.some(i=>i.isWrite()&&!i.init))return;let[n]=s,o=n.type==="FunctionName"?n.node:n.node?.init;return I(o)?o:void 0}function v(e,t){if((t&&b(e,t))?.kind==="hook")return V(e);if(!Xt(e)){let s=Ll(e);if(s)return s}for(let s of e.arguments){let n=m(s);if(I(n))return n}}function Ll(e){let t=F(e);if(!t)return;let r=W(t,"fn"),s=r&&m(r.value);return s&&I(s)?s:void 0}function os(e){return e.type==="Property"&&e.value.type==="Identifier"?e.value:e.type==="Property"&&e.value.type==="AssignmentPattern"&&e.value.left.type==="Identifier"?e.value.left:void 0}function We(e,t){let r=Ue(e.params,0);if(r?.type==="AssignmentPattern"&&(r=r.left),r?.type!=="ObjectPattern")return new Map;let s=r.properties.find(c=>c.type==="Property"&&$(c)==="assert");if(!s)return new Map;let n=new Map,o=(c,l)=>{let u=et(c,t);u&&n.set(u,l)},i=os(s);i&&o(i,void 0);let a=s.value.type==="AssignmentPattern"?s.value.left:s.value;if(a.type==="ObjectPattern")for(let c of a.properties){let l=os(c);l&&o(l,$(c))}return n}function ke(e){let t=0;for(let r of e){if(r.type==="AssignmentPattern"||r.type==="RestElement")break;fs(r)||(t+=1)}return t}function F(e){let{arguments:t}=e,r=!Xt(e)&&t[0]&&m(t[0]).type==="ObjectExpression",s=t[r?0:1];return s&&m(s).type==="ObjectExpression"?m(s):void 0}function W(e,t){if(e?.type==="ObjectExpression")for(let r=e.properties.length-1;r>=0;r-=1){let s=e.properties[r];if(s.type==="SpreadElement")return;let n=$(s);if(n===void 0)return;if(n===t)return s}}function st(e,t,r){let s=W(e,t);if(!s||s.kind==="get")return;let n=m(s.value),o=B(n,r.sourceCode.getScope(n));return o===null||(t==="only"?!!o.value:o.value!==void 0&&o.value!==!1)?s:void 0}var Gl=4294967295;function St(e,t){let r=W(F(e),"plan");if(r===void 0)return!1;let s=B(r.value,t.sourceCode.getScope(r.value));return Yt(s)}function Yt(e){return typeof e?.value=="number"&&Number.isSafeInteger(e.value)&&e.value>0&&e.value<=Gl}function ds(e,t,r){return Ht(e,t,r)!==void 0}function gs(e,t,r){return ds(e,t,r)||M(m(e),t)}function Ht(e,t,r){if(e?.type!=="Identifier")return;let s=et(e,t);if(s?.defs.length!==1||s.defs[0].type!=="Parameter")return;let n=s.defs[0].node,o=q(n.params);if(!(!o||Wt(o,n,t)!==s))return ys(n,t,r)}var ht=new Set,is=Symbol("contextCallback");function ys(e,t,r){if(!I(e)||ht.has(e))return;let s=e[is];if(s!==void 0&&s.node===e&&s.imports===t)return s.kind;let n=ht.size===0,o;ht.add(e);try{let i=hs(e,t,r);o=i==="test"||i==="hook"?i:void 0}finally{ht.delete(e)}return(o!==void 0||n)&&(e[is]={node:e,imports:t,kind:o}),o}function Bl(e,t,r,s){if(!tt(e))return Et;let n=e.defs[0].node,o=We(n,t);return!o.has(e)||!s(ys(n,t,r))?Et:o.get(e)??Bt}function P(e,t,r){if(!e)return;let s=b(e,t);if(s?.kind==="hook"&&s.modifiers.length===0||N(e,o=>gs(o,t,r)))return"hook";if(s)return s.kind!=="hook"&&s.modifiers.every(o=>_.has(o.name))?s.kind:void 0;if(He(e,t))return"test";let n=K(e);if(n!==void 0)return ds(n,t,r)?"test":void 0}function Te(e,t,r){let s=e.parent;for(;s;){if(I(s))return hs(s,t,r);s=s.parent}}function hs(e,t,r){let s=Oe(e);if(s)return V(s)===e||v(s,t)===e?P(s,t,r):void 0;let n=r&&D(e,r,t);return P(n,t,r)}function qt(e,t){return e.type==="Identifier"&&t.assertNamespace.has(e.name)&&be(e,t)}function Hl(e,t){return e.type==="Identifier"&&t.assertNamed.get(e.name)==="strict"&&be(e,t)}function ql(e,t){e=m(e);let r=e.type==="MemberExpression"?m(e.object):void 0;return e.type==="MemberExpression"&&!e.computed&&r?.type==="Identifier"&&qt(r,t)&&e.property.type==="Identifier"&&e.property.name==="strict"}function Ul(e,t){if(e=m(e),e.type!=="MemberExpression"||e.computed||e.property.type!=="Identifier"||e.property.name!=="assert")return!1;let r=m(e.object);return r?.type==="Identifier"||M(r,t)}function Vl(e,t){if(e=m(e),e.type!=="MemberExpression"||e.computed||e.property.type!=="Identifier")return;let r=m(e.object);if(e.property.name==="strict"&&qt(r,t))return{method:"ok",methodNode:void 0,isStrict:!0};if(qt(r,t))return{method:e.property.name,methodNode:e.property,isStrict:t.strictAssertLocals.has(r.name)};if(Hl(r,t))return{method:e.property.name,methodNode:e.property,isStrict:!0};if(ql(r,t))return{method:e.property.name,methodNode:e.property,isStrict:!0};if(Ul(r,t)&&e.property.name!=="strict")return{method:e.property.name,methodNode:e.property,isStrict:!1,contextReceiver:m(r.object)}}var je=new Map([["equal","strictEqual"],["notEqual","notStrictEqual"],["deepEqual","deepStrictEqual"],["notDeepEqual","notDeepStrictEqual"]]),te=us(Pl,(e,t)=>{let r=m(e.callee);if(r.type==="Identifier"&&t.assertNamed.get(r.name)==="strict"&&be(r,t))return{method:"ok",methodNode:void 0,isStrict:!0};if(r.type==="Identifier"&&t.assertNamed.has(r.name)&&be(r,t))return{method:t.assertNamed.get(r.name),methodNode:r,isStrict:t.strictAssertLocals.has(r.name)};if(r.type==="Identifier"&&t.assertNamespace.has(r.name)&&be(r,t))return{method:"ok",methodNode:void 0,isStrict:t.strictAssertLocals.has(r.name)};let s=Vl(r,t);if(s)return s});var Ss="too-few-arguments",bs="too-many-arguments",xs="not-string-message",Wl=new Map([["ok",{min:1,max:2}],["equal",{min:2,max:3}],["notEqual",{min:2,max:3}],["strictEqual",{min:2,max:3}],["notStrictEqual",{min:2,max:3}],["deepEqual",{min:2,max:3}],["notDeepEqual",{min:2,max:3}],["deepStrictEqual",{min:2,max:3}],["notDeepStrictEqual",{min:2,max:3}],["partialDeepStrictEqual",{min:2,max:3}],["match",{min:2,max:3}],["doesNotMatch",{min:2,max:3}],["throws",{min:1,max:3}],["doesNotThrow",{min:1,max:3}],["rejects",{min:1,max:3}],["doesNotReject",{min:1,max:3}],["ifError",{min:1,max:1,hasMessage:!1}]]),Es=new Set(["ok","match","doesNotMatch"]),$l=new Set(["match","doesNotMatch"]),Kl=new Set(["throws","doesNotThrow","rejects","doesNotReject"]);function zl(e,t){return e=m(e),e.type==="ArrayExpression"||e.type==="ObjectExpression"?!0:e.type==="Identifier"&&e.name==="undefined"||e.type==="UnaryExpression"&&e.operator==="void"?!Es.has(t):e.type!=="Literal"?!1:e.value===null?!Es.has(t):typeof e.value=="string"?!1:!($l.has(t)&&!e.value)}var Xl=e=>{let t=d(e);if(!t.isAssertOrTestFile)return;let r=y(t,{trackHooks:!0});e.on("CallExpression",s=>{r.update(s);let n=R(s,t,r);if(!n)return;let{method:o}=n,i=Wl.get(o);if(!i||s.arguments.some(p=>p.type==="SpreadElement"))return;let{min:a,max:c,hasMessage:l=!0}=i,u=s.arguments.length;if(u<a)return{node:s,messageId:Ss,data:{min:a}};if(!l||Kl.has(o))return u>c?{node:s,messageId:bs,data:{max:c}}:void 0;if(u>=c&&zl(s.arguments[c-1],o))return{node:s.arguments[c-1],messageId:xs}}),e.onExit("CallExpression",s=>{r.leave(s)})},Yl={create:Xl,meta:{type:"problem",docs:{description:"Enforce the correct number of arguments for `node:assert` assertions.",recommended:"unopinionated"},fixable:void 0,schema:[],messages:{[Ss]:"Not enough arguments. Expected at least {{min}}.",[bs]:"Too many arguments. Expected at most {{max}}.",[xs]:"Assertion message must be a string, an `Error`, or a function."},languages:["js/js"]}},ks=Yl;function Jt(e,t){let{parent:r}=e;switch(r.type){case"CallExpression":case"NewExpression":return r.arguments.length===1&&r.arguments[0]===e?t.sourceCode.getTokenAfter(r.typeArguments??r.callee,Be):void 0;case"DoWhileStatement":return r.test===e?t.sourceCode.getTokenAfter(r.body,Be):void 0;case"IfStatement":case"WhileStatement":return r.test===e?t.sourceCode.getFirstToken(r,1):void 0;case"ImportExpression":return r.source===e?t.sourceCode.getFirstToken(r,1):void 0;case"SwitchStatement":return r.discriminant===e?t.sourceCode.getFirstToken(r,1):void 0;case"WithStatement":if(r.object===e)return t.sourceCode.getFirstToken(r,1)}}function Jl([e,t],r){let s=r.sourceCode.getTokenBefore(e);if(!s||!Be(s))return;let n=r.sourceCode.getTokenAfter(t);if(!(!n||!Gt(n)))return[s,n]}var Cs=Symbol("SYNTAX_OPENING_PARENTHESIS_INITIAL_VALUE");function*Ql(e,t){if(!e||!e.parent||e.parent.type==="CatchClause"&&e.parent.param===e)return;let r=Cs,s=[e,e];for(;s=Jl(s,t);){let[n]=s;if(r===Cs&&(r=Jt(e,t)),n===r)break;yield s}}var Qt=Ql;var $e=new WeakMap;function Pe(e,t){if(!e||!$e.has(e)){let r=[];for(let[s,n]of Qt(e,t))r.unshift(s),r.push(n);$e.set(e,r)}return $e.get(e)}function de(e,t){let r=Pe(e,t),[s]=t.sourceCode.getRange(r[0]??e),[,n]=t.sourceCode.getRange(r.at(-1)??e);return[s,n]}function re(e,t){if($e.has(e))return $e.get(e).length>0;let r=Qt(e,t).next().done;return r&&$e.set(e,[]),!r}var Ts=e=>e?.type==="Literal"&&typeof e.value=="string",Me=e=>Ts(e)||e?.type==="TemplateLiteral",bt=(e,t)=>e?.type==="Literal"&&typeof e.value=="boolean"&&(t===void 0||e.value===t),nt=e=>{if(Ts(e))return e.value;if(e?.type==="TemplateLiteral"&&e.expressions.length===0)return e.quasis[0].value.cooked},ot=e=>e?.type==="Literal"&&!!e.regex;function xt(e){return e.type==="ExpressionStatement"||e.type==="ChainExpression"&&e.parent.type==="ExpressionStatement"}var Zl=["DoWhileStatement","ForInStatement","ForOfStatement","ForStatement","WhileStatement"],Is=Zl;function Ie(e){return Is.includes(e.type)}function eu(e,t){return e.type==="AwaitExpression"||t&&e.type==="YieldExpression"||e.type==="ForOfStatement"&&e.await||e.type==="VariableDeclaration"&&e.kind==="await using"}function ge(e,t,{includeYield:r=!0}={}){if(eu(e,r))return!0;if(I(e))return!1;for(let s of t[e.type]??[]){let n=e[s];if(Array.isArray(n)){for(let o of n)if(o?.type&&ge(o,t,{includeYield:r}))return!0}else if(n?.type&&ge(n,t,{includeYield:r}))return!0}return!1}function Zt(e){let{sourceCode:t}=e,r=t.getAllComments?.();return r?.length?r:t.comments??[]}var tu=new Set(["any","error","unknown"]),vs=e=>tu.has(e.intrinsicName);function it(e,t){if(!vs(e)&&!e.isTypeParameter()&&(e=t.getNonNullableType(e),!(e.isIntersection()&&e.types.some(r=>r.isTypeParameter())))){if(e.isUnion()){let r=e.types.map(s=>it(s,t));return r.every(Boolean)?!0:r.every(s=>s===!1)?!1:void 0}return t.getPromisedTypeOfPromise(e)!==void 0}}function kt(e){return xt(e.parent)}function ru(e,t){if(e?.type==="SequenceExpression")return e.expressions.at(-1)===t;if(e?.type==="LogicalExpression")return e.right===t;if(e?.type==="ConditionalExpression")return e.test!==t}function Y(e){let t=Z(e),r=oe(t.parent),s=!0;for(;;){if(r?.type==="UnaryExpression"&&r.operator==="void"){s=!1,t=r,r=oe(t.parent);continue}let n=ru(r,t);if(n===void 0)break;s&&=n,t=Z(r),r=oe(t.parent)}if(r?.type==="ExpressionStatement"){for(let n=e;n!==r;n=n.parent)es(n)&&(s=!1);return{statement:r,canAwait:s}}}function ae(e,t){for(let r=e;r&&r!==t;r=r.parent)if(r.type==="StaticBlock")return!0;return!1}function at(e,t,{includeLoops:r=!1}={}){switch(e.type){case"IfStatement":case"ConditionalExpression":return t!==e.test;case"LogicalExpression":return t===e.right;case"TryStatement":return t===e.handler;case"SwitchCase":return e.consequent.includes(t);case"WhileStatement":case"DoWhileStatement":case"ForStatement":case"ForInStatement":case"ForOfStatement":return r&&t===e.body;default:return!1}}function O(e){for(let t=e.parent;t;t=t.parent)if(I(t))return t}var su=new Set(["forEach","map","flatMap"]);function Ke(e){let{parent:t}=e;return t?.type==="CallExpression"&&t.arguments[0]===e&&t.callee.type==="MemberExpression"&&!t.callee.computed&&su.has(t.callee.property.name)}function De(e){if(e=S(e),e?.type!=="MemberExpression"||e.computed||e.property.type!=="Identifier"||e.property.name!=="process")return;let t=S(e.object);return t?.type==="Identifier"&&(t.name==="globalThis"||t.name==="global")?t:void 0}function Q(e,t,r){if(t?.type!=="Identifier"||t.name!==r)return!1;let s=C(e.sourceCode.getScope(t),t);return!s||s.defs.length===0}function er(e,t){return e=m(e),e.type==="Literal"?!e.regex:e.type==="Identifier"?["undefined","NaN","Infinity"].includes(e.name)&&Q(t,e,e.name):e.type==="TemplateLiteral"?!0:e.type==="UnaryExpression"}function _e(e,t){if(er(e,t))return!0;let r=ze(e,t);return r!==void 0&&er(r,t)}function ze(e,t){let r=m(e);if(r.type!=="Identifier")return;let s=C(t.sourceCode.getScope(r),r.name),n=s?.defs.length===1?s.defs[0]:void 0;return n?.type==="Variable"&&n.node.id.type==="Identifier"&&!!n.node.init&&s.references.every(i=>i.init||!i.isWrite())?n.node.init:void 0}var tr="consistent-assert-style",nu={[tr]:"Prefer `{{expected}}` over `{{actual}}`."};function As(e){return e.importKind===void 0||e.importKind==="value"}function ou(e){if(!As(e))return!1;if(e.type==="ImportDefaultSpecifier")return!0;if(e.type!=="ImportSpecifier")return!1;let t=X(e);return t==="default"||t==="strict"}function iu(e){let{sourceCode:t}=e,r=new Set;for(let s of t.ast.body)if(!(s.type!=="ImportDeclaration"||typeof s.source.value!="string"||!Vt.has(s.source.value)||!As(s)))for(let n of s.specifiers)au(t,n,r);return r}function au(e,t,r){if(!ou(t))return;let[s]=e.getDeclaredVariables(t);if(s)for(let n of s.references)r.add(n.identifier)}function ws(e,t,r){let{sourceCode:s}=t;if(e.type==="Identifier"&&!re(e,t)&&r.has(e)||e.type==="MemberExpression"&&!e.computed&&!e.optional&&e.property.type==="Identifier"&&e.property.name==="strict"&&e.object.type==="Identifier"&&!re(e.object,t)&&!re(e,t)&&r.has(e.object))return s.getText(e)}var cu=e=>{let{sourceCode:t}=e,{style:r}=e.options[0],s=iu(e);s.size!==0&&e.on("CallExpression",n=>{let{callee:o}=n;if(r==="assert-ok"){if(n.optional)return;let c=ws(o,e,s);return c?{node:o,messageId:tr,data:{expected:`${c}.ok(\u2026)`,actual:`${c}(\u2026)`},fix:l=>l.insertTextAfter(o,".ok")}:void 0}if(n.optional||o.type!=="MemberExpression"||re(o,e)||o.optional||o.computed||o.property.type!=="Identifier"||o.property.name!=="ok")return;let i=ws(o.object,e,s);if(!i)return;let a={node:o.property,messageId:tr,data:{expected:`${i}(\u2026)`,actual:`${i}.ok(\u2026)`}};return t.getCommentsInside(o).length===0&&(a.fix=c=>c.removeRange([t.getRange(o.object)[1],t.getRange(o.property)[1]])),a})},lu={create:cu,meta:{type:"suggestion",docs:{description:"Enforce a consistent truthiness assertion style.",recommended:!0},fixable:"code",schema:[{type:"object",properties:{style:{enum:["assert","assert-ok"],description:"Whether truthiness assertions should use `assert(\u2026)` or `assert.ok(\u2026)`."}},additionalProperties:!1}],defaultOptions:[{style:"assert-ok"}],messages:nu,languages:["js/js"]}},Rs=lu;var Os="consistent-assert-throws-callback-style/prefer-block",js="consistent-assert-throws-callback-style/prefer-expression",uu={[Os]:"Use a block body for the `assert.throws()` callback.",[js]:"Use an expression body for the `assert.throws()` callback."},Ps=new Set(["AssignmentExpression","ClassExpression","FunctionExpression","ObjectExpression"]),pu=new Set([...Ps,"SequenceExpression"]);function fu(e,t){return e.lines[e.getLoc(t).start.line-1].match(/^\s*/)[0]}function mu(e,t,r){let[s]=Pe(t,r),n=s??t,o=e.getTokenBefore(n);if(!o)return[];let i=e.getRange(o)[1];return e.getCommentsBefore(n).filter(a=>e.getRange(a)[0]>i)}function du(e,t,r){let n=Pe(t,r).at(-1)??t,o=e.getTokenAfter(n,{includeComments:!0});return o?.type==="Block"||o?.type==="Line"}function Ms(e,t){let{sourceCode:r}=t,s=re(e,t),n=s?de(e,t):r.getRange(e),[o]=mu(r,e,t),[i,a]=o?[r.getRange(o)[0],n[1]]:n,c=r.text.slice(i,a),l=m(e);return{range:[i,a],text:!s&&Ps.has(l.type)?`(${c})`:c}}function gu(e,t){return e.getAllComments().some(r=>r.type==="Line"&&e.getRange(r)[0]>=t[0]&&e.getRange(r)[1]<=t[1])}function Ds(e,t){return t.sourceCode.getLoc(e.body).start.line===t.sourceCode.getLoc(e).start.line}function yu(e,t){let{sourceCode:r}=t;if(!Ds(e,t)||e.async||e.returnType)return!1;let s=Ms(e.body,t);return!gu(r,r.getRange(s))&&!du(r,e.body,t)}function hu(e){if(e.body.type!=="BlockStatement"||e.body.body.length!==1)return;let[t]=e.body.body;return t.type==="ExpressionStatement"?t:void 0}function Eu(e,t){let{sourceCode:r}=t,{expression:s}=e,n=r.getText(s),o=m(s);return pu.has(o.type)?`(${n})`:n}function Su(e,t){let{sourceCode:r}=t;return Ds(e,t)&&!e.async&&!e.returnType&&r.getCommentsInside(e.body).length===0}function bu(e,t){if(e.body.type==="BlockStatement")return;let{sourceCode:r}=t,s={node:e.body,messageId:Os};return yu(e,t)&&(s.fix=n=>{let o=fu(r,e),i=Ms(e.body,t);return n.replaceTextRange(r.getRange(i),`{
3
+ ${o} ${i.text};
4
+ ${o}}`)}),s}function xu(e,t){let r=hu(e);if(!r)return;let s={node:e.body,messageId:js};return Su(e,t)&&(s.fix=n=>n.replaceText(e.body,Eu(r,t))),s}function ku(e,t,r){let{imports:s,tracker:n,style:o}=r;if(R(e,s,n)?.method!=="throws")return;let[a]=e.arguments,c=a&&m(a);if(!(!c||c.type!=="ArrowFunctionExpression"))return o==="block"?bu(c,t):xu(c,t)}var Cu=e=>{let t=d(e);if(!t.isAssertOrTestFile)return;let r=y(t,{trackHooks:!0}),{style:s}=e.options[0],n={imports:t,tracker:r,style:s};e.on("CallExpression",o=>{let i=ku(o,e,n);return r.update(o),i}),e.onExit("CallExpression",o=>{r.leave(o)})},Tu={create:Cu,meta:{type:"layout",docs:{description:"Enforce a consistent body style for `assert.throws()` arrow callbacks.",recommended:!1},fixable:"code",schema:[{type:"object",properties:{style:{enum:["block","expression"],description:"Whether `assert.throws()` arrow callbacks should use block bodies or expression bodies."}},additionalProperties:!1}],defaultOptions:[{style:"block"}],messages:uu,languages:["js/js"]}},_s=Tu;var Ns="consistent-modifier-style/prefer-chained",Fs="consistent-modifier-style/prefer-options",Iu={[Ns]:"Use the chained modifier `.{{modifier}}` instead of the `{{modifier}}` option.",[Fs]:"Use the `{{modifier}}` option instead of the chained `.{{modifier}}`."},vu=e=>{let t=d(e);if(!t.isTestFile)return;let{style:r}=e.options[0];e.on("CallExpression",s=>{let n=b(s,t);if(n&&n.kind!=="hook"){if(r==="chained"){if(n.hasExpectedFailure||n.modifiers.length>0)return;let o=F(s),i=[];for(let a of _){let c=W(o,a),l=c&&m(c.value);l?.type==="Literal"&&l.value===!0&&i.push({node:c,messageId:Ns,data:{modifier:a}})}return i.length===1?i:void 0}return n.modifiers.filter(o=>_.has(o.name)).map(o=>({node:o,messageId:Fs,data:{modifier:o.name}}))}})},wu={create:vu,meta:{type:"suggestion",docs:{description:"Enforce a consistent style for test modifiers.",recommended:!1},schema:[{type:"object",properties:{style:{enum:["chained","options"],description:"Whether modifiers should be chained (`test.skip()`) or passed as options (`{skip: true}`)."}},additionalProperties:!1}],defaultOptions:[{style:"chained"}],messages:Iu,languages:["js/js"]}},Ls=wu;var Gs="consistent-test-context-name",Au={[Gs]:"Name the test context parameter `{{expected}}` instead of `{{actual}}`."},Ru=e=>{let t=d(e);if(!t.isTestFile)return;let r=e.options[0].name,s=y(t),n=new Set;e.on("CallExpression",o=>{let i=s.isSubtestCall(o),a=b(o,t)?.kind==="test";if(s.update(o),!a&&!i)return;let c=q(ie(o,e,t)?.params);if(c&&c.name!==r&&!n.has(c))return n.add(c),{node:c,messageId:Gs,data:{expected:r,actual:c.name}}}),e.onExit("CallExpression",o=>{s.leave(o)})},Ou={create:Ru,meta:{type:"suggestion",docs:{description:"Enforce a consistent name for the test context parameter.",recommended:"unopinionated"},schema:[{type:"object",properties:{name:{type:"string",description:"The required name for the test context parameter."}},additionalProperties:!1}],defaultOptions:[{name:"t"}],messages:Au,languages:["js/js"]}},Bs=Ou;function ct(e,t,r){try{return new RegExp(e,"v")}catch(s){throw new Error(`Invalid \`${r}\` option for \`${t}\`: ${s.message}`,{cause:s})}}var Hs="consistent-test-filename",ju={[Hs]:"Test file name `{{name}}` does not match the required pattern `{{pattern}}`."},Pu=e=>{if(!d(e).isTestFile)return;let r=e.physicalFilename??e.filename;if(!r||r==="<input>"||r==="<text>")return;let{pattern:s}=e.options[0],n=ct(s,"consistent-test-filename","pattern"),o=r.split(/[/\\]/).pop();n.test(o)||e.on("Program",i=>({node:i,messageId:Hs,data:{name:o,pattern:s}}))},Mu={create:Pu,meta:{type:"suggestion",docs:{description:"Enforce a consistent test file name pattern.",recommended:!1},schema:[{type:"object",properties:{pattern:{type:"string",description:"A regular expression the test file name must match."}},additionalProperties:!1}],defaultOptions:[{pattern:String.raw`\.test\.[cm]?[jt]sx?$`}],messages:ju,languages:["js/js"]}},qs=Mu;var Us="consistent-test-it",Du={[Us]:"Prefer `{{expected}}` over `{{actual}}` {{location}}."},_u=e=>{let t=d(e);if(!t.isTestFile)return;let{fn:r,withinDescribe:s}=e.options[0],n=Ve();e.on("CallExpression",o=>{let i=b(o,t);if(!i)return;let a;if(i.kind==="test"){let c=n.depth>0,l=c?s:r;i.name!==l&&(a={node:o,messageId:Us,data:{expected:l,actual:i.name,location:c?"inside a `describe`":"at the top level"}})}else i.kind==="suite"&&n.enterSuite(o);return a}),e.onExit("CallExpression",o=>{n.exitSuite(o)})},Nu={create:_u,meta:{type:"suggestion",docs:{description:"Enforce consistent use of `test` or `it`.",recommended:!1},schema:[{type:"object",properties:{fn:{enum:["test","it"],description:"The name to use for top-level test cases."},withinDescribe:{enum:["test","it"],description:"The name to use for test cases inside a `describe`."}},additionalProperties:!1}],defaultOptions:[{fn:"test",withinDescribe:"it"}],messages:Du,languages:["js/js"]}},Vs=Nu;var Fu=/^[([]/,Lu=new Set([";","{"]),Gu=new Set(["Program","BlockStatement","StaticBlock","SwitchCase","TSModuleBlock"]);function lt(e,t,r,s){if(!Fu.test(r)||!Gu.has(t.parent?.type))return!1;let{sourceCode:n}=s,o=n.getTokenBefore(e);return o!==null&&n.getRange(o)[1]<=n.getRange(t)[0]&&!Lu.has(o.value)}var Ws="hooks-order/error",Bu={[Ws]:"Hook `{{current}}` must come before `{{invalid}}`."},Hu=["before","beforeEach","afterEach","after"],Ct=Object.fromEntries(Hu.map((e,t)=>[e,t]));function qu(e){return e.type==="SwitchCase"?e.consequent:e.body}function Uu(e,t,r){let{sourceCode:s}=r,n=qu(e),o=t.map(g=>n.indexOf(g.statement)),i=Math.min(...o),a=Math.max(...o);if(a-i+1!==t.length)return;for(let[g,h]of t.entries()){if(s.getCommentsInside(h.statement).length!==s.getCommentsInside(h.call).length)return;let k=t[g+1];if(k&&s.getTokensBetween(h.statement,k.statement,{includeComments:!0}).length>0)return}let c=n[i],l=n[a],u=s.getCommentsBefore(c).at(-1);if(u&&s.getLoc(c).start.line-s.getLoc(u).end.line<=1)return;let[p]=s.getCommentsAfter(l);if(p&&s.getLoc(p).start.line===s.getLoc(l).end.line)return;let f=t.toSorted((g,h)=>Ct[g.name]-Ct[h.name]);return function*(g){for(let[h,k]of t.entries()){if(f[h].statement===k.statement)continue;let T=s.getText(f[h].call),x=lt(k.call,k.statement,T,r)?";":"";yield g.replaceText(k.call,`${x}${T}`)}}}function Vu(e,t,r){let s=[],n,o=!1;for(let[i,a]of t.entries()){let c=Ct[a.name],l=t.slice(0,i).find(u=>Ct[u.name]>c);l&&(o||(n=Uu(e,t,r),o=!0),s.push({node:a.statement.expression,messageId:Ws,data:{current:a.name,invalid:l.name},fix:n}))}return s}var Wu=e=>{let{sourceCode:t}=e,r=d(e);if(!r.isTestFile)return;let s=new Map,n=y(r,{trackHooks:!0});e.on("CallExpression",o=>{let i=N(o,n.isContextReceiver);n.update(o);let a=b(o,r);if(!(a?.kind==="hook"||i))return;let u=(i?m(o.callee).property:a).name,p=oe(o.parent);if(p?.type!=="ExpressionStatement")return;let f=p.parent;if(f?.type!=="BlockStatement"&&f?.type!=="Program"&&f?.type!=="StaticBlock"&&f?.type!=="SwitchCase")return;let g=s.get(f);g||(g=[],s.set(f,g)),g.push({name:u,statement:p,call:o})}),e.onExit("CallExpression",o=>{n.leave(o)}),e.onExit("Program",()=>{let o=[];for(let[i,a]of s)o.push(...Vu(i,a,e));return o})},$u={create:Wu,meta:{type:"suggestion",docs:{description:"Enforce a consistent order of hook declarations.",recommended:"unopinionated"},fixable:"code",schema:[],messages:Bu,languages:["js/js"]}},$s=$u;var rr="max-assertions",Ku={[rr]:"Too many assertions ({{count}}). Maximum allowed is {{max}}."},zu=e=>{let t=d(e);if(!t.isTestFile)return;let{max:r}=e.options[0],s=y(t),n=[];e.on("CallExpression",i=>{let a=b(i,t)?.kind==="test"||s.isSubtestCall(i);if(s.update(i),a){n.push({node:i,count:0});return}n.length>0&&R(i,t,s)&&(n.at(-1).count+=1)}),e.onExit("CallExpression",i=>{if(s.leave(i),n.at(-1)?.node!==i)return;let{count:a}=n.pop();if(a>r)return{node:i,messageId:rr,data:{count:a,max:r}}});let o=new WeakSet;e.on(j,i=>{let a=D(i,e,t);P(a,t,e)==="test"&&(o.add(i),n.push({node:i,count:0}))}),e.onExit(j,i=>{if(!o.delete(i)||n.at(-1)?.node!==i)return;let{count:a}=n.pop();if(a>r)return{node:i,messageId:rr,data:{count:a,max:r}}})},Xu={create:zu,meta:{type:"suggestion",docs:{description:"Enforce a maximum number of assertions in a test.",recommended:!1},schema:[{type:"object",properties:{max:{type:"integer",minimum:1,description:"The maximum number of assertions allowed in a test."}},additionalProperties:!1}],defaultOptions:[{max:5}],messages:Ku,languages:["js/js"]}},Ks=Xu;var zs="max-nested-describe",Yu={[zs]:"Describe blocks are nested too deeply ({{depth}}). Maximum allowed is {{max}}."},Ju=e=>{let t=d(e);if(!t.isTestFile)return;let{max:r}=e.options[0],s=Ve();e.on("CallExpression",n=>{if(b(n,t)?.kind==="suite"&&(s.enterSuite(n),s.depth>r))return{node:n,messageId:zs,data:{depth:s.depth,max:r}}}),e.onExit("CallExpression",n=>{s.exitSuite(n)})},Qu={create:Ju,meta:{type:"suggestion",docs:{description:"Enforce a maximum depth for nested `describe` blocks.",recommended:!0},schema:[{type:"object",properties:{max:{type:"integer",minimum:1,description:"The maximum allowed depth of nested `describe` blocks."}},additionalProperties:!1}],defaultOptions:[{max:5}],messages:Yu,languages:["js/js"]}},Xs=Qu;var Ys="no-assert-in-describe",Zu={[Ys]:"Assertion runs when the suite is built, not when a test runs. Move it into a test or hook."},ep=e=>{let t=d(e);if(!t.isTestFile)return;let r=y(t);e.on("CallExpression",s=>{if(r.update(s),!!R(s,t,r)&&Te(s,t,e)==="suite")return{node:s,messageId:Ys}}),e.onExit("CallExpression",s=>{r.leave(s)})},tp={create:ep,meta:{type:"problem",docs:{description:"Disallow assertions directly inside a `describe` body.",recommended:!0},schema:[],messages:Zu,languages:["js/js"]}},Js=tp;var Qs="no-assert-in-hook",rp={[Qs]:"Avoid assertions inside a hook. A hook failure is attributed to every affected test rather than reported as a focused failure. Assert inside a test instead."},sp=e=>{let t=d(e);if(!t.isTestFile)return;let r=y(t,{trackHooks:!0});e.on("CallExpression",s=>{if(r.update(s),!!R(s,t,r)&&Te(s,t,e)==="hook")return{node:s,messageId:Qs}}),e.onExit("CallExpression",s=>{r.leave(s)})},np={create:sp,meta:{type:"suggestion",docs:{description:"Disallow assertions inside hooks.",recommended:!1},schema:[],messages:rp,languages:["js/js"]}},Zs=np;var en="no-assert-match-string/error",tn="no-assert-match-string/regexp-suggestion",rn="no-assert-match-string/assertion-suggestion",op={[en]:"The second argument to `{{method}}()` must be a `RegExp`, not a string.",[tn]:"Wrap the string in `new RegExp()`.",[rn]:"Compare with `{{replacementMethod}}()`."},ip=new Set(["match","doesNotMatch"]),ap=new Map([["match","strictEqual"],["doesNotMatch","notStrictEqual"]]);function cp(e){let t=nt(m(e));if(t===void 0)return!1;try{return new RegExp(t)instanceof RegExp}catch{return!1}}function lp({node:e,parsed:t,regexpArgument:r,sourceCode:s}){let n=[];cp(r)&&n.push({messageId:tn,fix:i=>i.replaceText(r,`new RegExp(${s.getText(r)})`)});let o=ap.get(t.method);if(o&&t.methodNode&&e.callee.type!=="Identifier"){let i=up(e,t,s);i&&n.push({messageId:rn,data:{replacementMethod:o},fix:a=>a.replaceTextRange(i,o)})}return n}function up(e,t,r){let{callee:s}=e;if(s.type==="MemberExpression"&&s.object.type==="MemberExpression"&&!s.object.computed&&s.object.property.type==="Identifier"&&s.object.property.name==="strict"){let n=[r.getRange(s.object.property)[0],r.getRange(t.methodNode)[1]];return pp(r,s,n)?void 0:n}return r.getRange(t.methodNode)}function pp(e,t,r){return e.getCommentsInside(t).some(s=>{let n=e.getRange(s);return n[0]>=r[0]&&n[1]<=r[1]})}var fp=e=>{let{sourceCode:t}=e,r=d(e);if(!r.isAssertOrTestFile)return;let s=y(r,{trackHooks:!0});e.on("CallExpression",n=>{s.update(n);let o=R(n,r,s);if(!o||!ip.has(o.method))return;let i=n.arguments[1];if(!i||i.type==="SpreadElement"||!Me(m(i)))return;let a={node:i,messageId:en,data:{method:o.method}},c=lp({node:n,parsed:o,regexpArgument:i,sourceCode:t});return c.length>0&&(a.suggest=c),a}),e.onExit("CallExpression",n=>{s.leave(n)})},mp={create:fp,meta:{type:"problem",docs:{description:"Disallow strings as the regexp argument of `assert.match()`/`assert.doesNotMatch()`.",recommended:"unopinionated"},hasSuggestions:!0,schema:[],messages:op,languages:["js/js"]}},sn=mp;var nn="no-assert-throws-async/error",on="no-assert-throws-async/suggestion",dp={[nn]:"`{{method}}` does not catch an async function, which never throws synchronously. Use `{{replacement}}` instead.",[on]:"Replace with `{{replacement}}`."},gp=new Map([["throws","rejects"],["doesNotThrow","doesNotReject"]]),yp=e=>{let t=d(e);if(!t.isAssertOrTestFile)return;let r=y(t,{trackHooks:!0});e.on("CallExpression",s=>{r.update(s);let n=R(s,t,r);if(!n)return;let o=gp.get(n.method);if(!o)return;let[i]=s.arguments;if(!i)return;let a=m(i);if(!I(a)||!a.async)return;let c=m(s.callee),l={method:n.method,replacement:o},u={node:c,messageId:nn,data:l};if(c.type==="MemberExpression"){let p=O(s),f=Y(s)?.canAwait===!0&&p?.async===!0&&!ae(s,p);u.suggest=[{messageId:on,data:l,*fix(g){yield g.replaceText(c.property,o),f&&(yield g.insertTextBefore(s,"await "))}}]}return u}),e.onExit("CallExpression",s=>{r.leave(s)})},hp={create:yp,meta:{type:"problem",docs:{description:"Disallow passing an async function to `assert.throws()`/`assert.doesNotThrow()`.",recommended:"unopinionated"},hasSuggestions:!0,schema:[],messages:dp,languages:["js/js"]}},an=hp;var cn="no-assert-throws-call/error",ln="no-assert-throws-call/suggestion",Ep={[cn]:"`{{method}}()` expects a function callback. The first argument is evaluated before the assertion starts, so what it does escapes it.",[ln]:"Wrap the call in an arrow function."};function Sp(e){let t=S(e.callee);return t.type==="MemberExpression"&&$(t)==="bind"}function un(e){return e.callee.type==="Identifier"&&e.callee.name==="Function"}function bp(e){return Sp(e)||un(e)}var xp=()=>({runs:!1,awaits:!1,yields:!1});function sr(e,t,r=xp()){if(!e)return r;switch(e.type){case"CallExpression":{if(bp(e))return r;r.runs=!0;break}case"NewExpression":{if(un(e))return r;r.runs=!0;break}case"TaggedTemplateExpression":{r.runs=!0;break}case"AwaitExpression":{r.awaits=!0;break}case"YieldExpression":{r.yields=!0;break}}if(!I(e))for(let s of t.visitorKeys[e.type]??[]){let n=e[s];if(Array.isArray(n))for(let o of n)sr(o,t,r);else sr(n,t,r)}return r}var kp=e=>{let{sourceCode:t}=e,r=d(e);if(!r.isAssertOrTestFile)return;let s=y(r,{trackHooks:!0});e.on("CallExpression",n=>{s.update(n);let o=R(n,r,s);if(!o||o.method!=="throws")return;let[i]=n.arguments;if(!i||i.type==="SpreadElement")return;let a=S(i),{runs:c,awaits:l,yields:u}=sr(a,t);if(!c)return;let p=["CallExpression","NewExpression","TaggedTemplateExpression"].includes(a.type);return{node:i,messageId:cn,data:{method:o.method},suggest:l||u||!p?void 0:[{messageId:ln,fix:f=>f.replaceText(i,`() => (${t.getText(i)})`)}]}}),e.onExit("CallExpression",n=>{s.leave(n)})},Cp={create:kp,meta:{type:"problem",docs:{description:"Disallow calling the function passed to `assert.throws()`.",recommended:"unopinionated"},hasSuggestions:!0,schema:[],messages:Ep,languages:["js/js"]}},pn=Cp;var fn="no-assert-throws-multiple-statements",Tp={[fn]:"Keep the `{{method}}()` callback to one statement so unrelated setup errors cannot satisfy the assertion."},Ip=new Set(["throws","rejects"]),vp=e=>{let t=d(e);if(!t.isAssertOrTestFile)return;let r=y(t,{trackHooks:!0});e.on("CallExpression",s=>{r.update(s);let n=R(s,t,r);if(!n||!Ip.has(n.method))return;let[o]=s.arguments;if(!o||o.type==="SpreadElement")return;let i=m(o);if(!(!I(i)||i.body.type!=="BlockStatement"||i.body.body.length<=1))return{node:i.body,messageId:fn,data:{method:n.method}}}),e.onExit("CallExpression",s=>{r.leave(s)})},wp={create:vp,meta:{type:"problem",docs:{description:"Disallow multiple statements in `assert.throws()`/`assert.rejects()` callbacks.",recommended:!0},schema:[],messages:Tp,languages:["js/js"]}},mn=wp;var dn="no-assert-throws-string/error",gn="no-assert-throws-string/suggestion",Ap={[dn]:"The second argument to `{{method}}()` is the failure message, not an error matcher, so the thrown error is not validated.",[gn]:"Match the error message with `{message: \u2026}`."},Rp=new Set(["throws","rejects"]),Op=e=>{let{sourceCode:t}=e,r=d(e);if(!r.isAssertOrTestFile)return;let s=y(r,{trackHooks:!0});e.on("CallExpression",n=>{s.update(n);let o=R(n,r,s);if(!o||!Rp.has(o.method))return;let i=n.arguments[1];if(!(!i||!Me(m(i))))return{node:i,messageId:dn,data:{method:o.method},suggest:[{messageId:gn,fix:a=>a.replaceText(i,`{message: ${t.getText(i)}}`)}]}}),e.onExit("CallExpression",n=>{s.leave(n)})},jp={create:Op,meta:{type:"problem",docs:{description:"Disallow a string as the error matcher of `assert.throws()`/`assert.rejects()`.",recommended:"unopinionated"},hasSuggestions:!0,schema:[],messages:Ap,languages:["js/js"]}},yn=jp;var hn="no-async-describe",Pp={[hn]:"`node:test` does await a `{{name}}` callback, so an `async` one registers its tests late and a rejection cancels them. Make the callback synchronous and do async setup in a hook."},Mp=e=>{let t=d(e);if(!t.isTestFile)return;let r=new Set;e.on("CallExpression",s=>{let n=b(s,t);if(n?.kind!=="suite")return;let o=ie(s,e,t);if(!(!o?.async||r.has(o)))return r.add(o),{node:o,messageId:hn,data:{name:n.name}}})},Dp={create:Mp,meta:{type:"problem",docs:{description:"Disallow `async` `describe` callbacks.",recommended:"unopinionated"},schema:[],messages:Pp,languages:["js/js"]}},En=Dp;var Sn="no-async-fn-without-await/error",bn="no-async-fn-without-await/suggestion",_p={[Sn]:"Async test/hook function has no `await`, `for await`, `await using` or `yield`.",[bn]:"Remove the `async` keyword."},Np=e=>{let{sourceCode:t}=e,r=d(e);if(!r.isTestFile)return;let s=y(r,{trackHooks:!0}),n=new Set;e.on("CallExpression",o=>{let i=s.isSubtestCall(o);s.update(o);let a=b(o,r),c=N(o,s.isContextReceiver);if(!a&&!i&&!c||a?.kind==="suite")return;let l=c?pe(o.arguments[0],e):ie(o,e,r);if(!l?.async||n.has(l)||ge(l.body,t.visitorKeys))return;n.add(l);let u=l.parent?.type==="Property"&&l.parent.value===l?l.parent:l,p=t.getFirstToken(u,T=>T.value==="async"),f={node:p,messageId:Sn},g=t.getTokenAfter(p),h=t.getRange(p)[1];return!t.getCommentsBefore(g).some(T=>t.getRange(T)[0]>=h)&&!l.generator&&(f.suggest=[{messageId:bn,fix(T){return T.removeRange([t.getRange(p)[0],t.getRange(g)[0]])}}]),f}),e.onExit("CallExpression",o=>{s.leave(o)})},Fp={create:Np,meta:{type:"suggestion",docs:{description:"Disallow async test/hook functions that have no `await` expression.",recommended:"unopinionated"},hasSuggestions:!0,schema:[],messages:_p,languages:["js/js"]}},xn=Fp;var kn="no-callback-and-promise",Lp={[kn]:"A {{kind}} cannot use both a callback parameter and a Promise; this `async` function also declares a callback."},Gp=e=>{let t=d(e);if(!t.isTestFile)return;let r=y(t,{trackHooks:!0}),s=new Set;e.on("CallExpression",n=>{let o=r.isSubtestCall(n),i=N(n,r.isContextReceiver);r.update(n);let a=b(n,t);if(a?.kind!=="test"&&a?.kind!=="hook"&&!o&&!i)return;let c=i?pe(n.arguments[0],e):ie(n,e,t);if(!(!c?.async||s.has(c)||ke(c.params)<2))return s.add(c),{node:Ue(c.params,1),messageId:kn,data:{kind:a?.kind==="hook"||i?"hook":"test"}}}),e.onExit("CallExpression",n=>{r.leave(n)})},Bp={create:Gp,meta:{type:"problem",docs:{description:"Disallow a test or hook from using both a callback and a Promise.",recommended:"unopinionated"},schema:[],messages:Lp,languages:["js/js"]}},Cn=Bp;var Tn="no-commented-tests/error",Hp={[Tn]:"Use `.skip()` or remove the commented-out test instead of commenting it out."},In=["test","it","describe","suite","before","after","beforeEach","afterEach"],qp=new Set(In),Up="(?:only|skip|todo|test|it|describe|suite|before|after|beforeEach|afterEach|expectFailure)";function Vp(e){let t=new Set(In);for(let[r,s]of e.locals)qp.has(s)&&t.add(r);for(let r of e.namespaces)t.add(r);return new RegExp(String.raw`^\s*\*?\s*(?:await\s+)?(?:${[...t].toSorted((r,s)=>s.length-r.length).map(r=>r.replaceAll("$",String.raw`\$`)).join("|")})(?:\s*\.\s*${Up}\s*)*\(`,"v")}function Wp(e,t,r){let s=r.value.split(`
5
+ `),n=e.sourceCode.getLoc(r).start.line;for(let[o,i]of s.entries())if(t.test(i)){e.report({loc:{line:n+o,column:0},messageId:Tn});return}}var $p=e=>{let t=d(e);if(!t.isTestFile)return;let r=Vp(t);e.on("Program:exit",()=>{for(let s of Zt(e))s.type==="Block"&&e.sourceCode.getText(s).startsWith("/**")||Wp(e,r,s)})},Kp={create:$p,meta:{type:"suggestion",docs:{description:"Disallow commented-out tests.",recommended:!1},schema:[],messages:Hp,languages:["js/js"]}},vn=Kp;var wn="no-compound-assertion",zp={[wn]:"Split this compound assertion into separate assertions so the failing operand is clear."};function nr(e){let t=m(e);return t.type!=="LogicalExpression"||t.operator!=="&&"?[e]:[...nr(t.left),...nr(t.right)]}function Xp(e,t){let r=e.lines[e.getLoc(t).start.line-1].slice(0,e.getLoc(t).start.column);return/^\s*$/.test(r)?r:void 0}function Yp(e,t){let r=e.getLoc(t),s=e.lines[r.end.line-1].slice(r.end.column);return/^\s*$/.test(s)}function Jp(e,t){let r=e.getText(t);return t.type==="SequenceExpression"?`(${r})`:r}function Qp({node:e,operands:t,sourceCode:r,context:s,hasPlan:n}){return o=>{if(n||e.arguments.length!==1||e.parent.type!=="ExpressionStatement"||!["Program","BlockStatement","StaticBlock"].includes(e.parent.parent.type)||r.getCommentsInside(e.parent).length>0||!Yp(r,e.parent))return;let i=r.text.slice(...de(e.callee,s)),a=Xp(r,e.parent);if(a===void 0)return;let c=t.map(l=>`${i}(${Jp(r,l)});`).join(`
6
+ ${a}`);return o.replaceText(e.parent,c)}}var Zp=e=>{let{sourceCode:t}=e,r=d(e);if(!r.isAssertOrTestFile)return;let s=y(r,{trackHooks:!0}),n=/\bplan\b/.test(t.text),o=i=>{let a=te(i,r);return a===void 0||a.contextReceiver!==void 0};e.on("CallExpression",i=>{if(s.update(i),R(i,r,s)?.method!=="ok")return;let[c]=i.arguments;if(!c||c.type==="SpreadElement")return;let l=m(c);if(l.type!=="LogicalExpression"||l.operator!=="&&")return;let u=nr(l);return{node:i,messageId:wn,fix:Qp({node:i,operands:u,sourceCode:t,context:e,hasPlan:n&&o(i)})}}),e.onExit("CallExpression",i=>{s.leave(i)})},ef={create:Zp,meta:{type:"suggestion",docs:{description:"Disallow compound truthiness assertions.",recommended:"unopinionated"},fixable:"code",schema:[],messages:zp,languages:["js/js"]}},An=ef;var On="no-conditional-assertion/error",tf={[On]:"Assertions should not be placed inside conditionals, as they may never execute."};function Rn(e,t,r){let s=b(e,t);return s?s.kind==="test"||s.kind==="hook"?v(e):void 0:r.isSubtestCall(e)?v(e):void 0}var rf=e=>{let t=d(e);if(!t.isTestFile)return;let r=[],s=y(t,{trackHooks:!0}),n=new WeakSet;e.on(j,o=>{let i=D(o,e,t),a=P(i,t,e);a!=="test"&&a!=="hook"||(n.add(o),r.push(o))}),e.onExit(j,o=>{n.delete(o)&&r.pop()}),e.on("CallExpression",o=>{s.update(o);let i=Rn(o,t,s);if(i){r.push(i);return}if(r.length===0||!R(o,t,s))return;let a=r.at(-1),c=o,l=o.parent;for(;l&&l!==a;){if(at(l,c,{includeLoops:!0}))return{node:o,messageId:On};c=l,l=l.parent}}),e.onExit("CallExpression",o=>{s.leave(o);let i=Rn(o,t,s);i&&r.at(-1)===i&&r.pop()})},sf={create:rf,meta:{type:"problem",docs:{description:"Disallow assertions inside conditional code within a test.",recommended:"unopinionated"},schema:[],messages:tf,languages:["js/js"]}},jn=sf;var Pn="no-conditional-in-test",nf={[Pn]:"Avoid conditional logic in a test; a test should run the same way every time."},of=e=>{let t=d(e);if(!t.isTestFile)return;let r=new Set,s=y(t,{trackHooks:!0});e.on("CallExpression",a=>{let c=b(a,t),l=s.isSubtestCall(a),u=N(a,s.isContextReceiver);if(!l&&!u&&c?.kind!=="test"&&c?.kind!=="hook")return;let p=v(a,t);p&&r.add(p),s.update(a)}),e.onExit("CallExpression",a=>{s.leave(a)});let n=a=>b(a,t)!==void 0||s.isSubtestCall(a)||N(a,s.isContextReceiver),o=a=>{for(let c=a;c;c=c.parent){if(I(c))return r.has(c)?{node:a,messageId:Pn}:void 0;if(c.type==="CallExpression"&&n(c))return}},i=new WeakSet;e.on(j,a=>{let c=D(a,e,t),l=P(c,t,e);l!=="test"&&l!=="hook"||(i.add(a),r.add(a))}),e.onExit(j,a=>{i.delete(a)&&r.delete(a)}),e.on("IfStatement",o),e.on("SwitchStatement",o),e.on("ConditionalExpression",o)},af={create:of,meta:{type:"suggestion",docs:{description:"Disallow conditional logic inside tests.",recommended:!1},schema:[],messages:nf,languages:["js/js"]}},Mn=af;var Dn="no-conditional-tests",cf={[Dn]:"Do not register a {{kind}} conditionally; it makes the suite structure non-deterministic."};function lf(e){let t=e,{parent:r}=t;for(;r;){if(I(r))return!1;if(at(r,t))return!0;t=r,{parent:r}=t}return!1}var uf=e=>{let t=d(e);if(!t.isTestFile)return;let r=y(t,{trackHooks:!0});e.on("CallExpression",s=>{let n=r.isSubtestCall(s),o=N(s,r.isContextReceiver);r.update(s);let i=b(s,t);if(!i&&!n&&!o)return;let a=Te(s,t,e);if(!(a==="hook"&&P(s,t,e)!=="hook")&&!((o||i?.kind==="hook")&&a==="test")&&lf(s))return{node:s,messageId:Dn,data:{kind:n?"test":o?"hook":i.kind}}}),e.onExit("CallExpression",s=>{r.leave(s)})},pf={create:uf,meta:{type:"problem",docs:{description:"Disallow conditionally registering tests, suites, and hooks.",recommended:!0},schema:[],messages:cf,languages:["js/js"]}},_n=pf;var Nn="no-conflicting-modifiers",ff={[Nn]:"Conflicting modifiers {{modifiers}}. `node:test` resolves them by precedence rather than reporting both: `skip` wins over everything, and `todo` wins over `expectFailure`."},mf=e=>{let t=d(e);if(!t.isTestFile)return;let r=y(t,{trackHooks:!0});e.on("CallExpression",s=>{let n=r.isSubtestCall(s);r.update(s);let o=b(s,t);if(!o&&!n||o?.kind==="hook")return;let i=new Set;o?.hasExpectedFailure&&i.add("expectFailure");for(let u of o?.modifiers??[])_.has(u.name)&&i.add(u.name);let a=F(s);for(let u of _)st(a,u,e)&&i.add(u);st(a,"expectFailure",e)&&i.add("expectFailure");let c=i.size===2&&i.has("only")&&!i.has("skip");if(i.size<2||c)return;let l=[...i].toSorted((u,p)=>u.localeCompare(p)).map(u=>`\`${u}\``).join(", ");return{node:s,messageId:Nn,data:{modifiers:l}}}),e.onExit("CallExpression",s=>{r.leave(s)})},df={create:mf,meta:{type:"problem",docs:{description:"Disallow conflicting test modifiers.",recommended:"unopinionated"},schema:[],messages:ff,languages:["js/js"]}},Fn=df;var Ln="no-constant-assertion",gf={[Ln]:"This assertion has a constant outcome, so it does not test code behavior."},yf=new Set(["equal","notEqual","strictEqual","notStrictEqual","deepEqual","notDeepEqual","deepStrictEqual","notDeepStrictEqual","partialDeepStrictEqual"]),hf=new Set(["match","doesNotMatch"]),Ef=e=>e===null||typeof e!="object"&&typeof e!="function";function se(e,t,r=new Set){if(!e)return!1;for(e=S(e);e.type==="UnaryExpression";)e=S(e.argument);switch(e.type){case"Literal":return!0;case"Identifier":{let s=ze(e,t);if(s){if(r.has(s))return!1;r.add(s);let o=se(s,t,r);if(r.delete(s),!o)return!1}let n=B(e,t.sourceCode.getScope(e));return n!==null&&Ef(n.value)}case"TemplateLiteral":return e.expressions.every(s=>se(s,t,r));case"ArrayExpression":return e.elements.every(s=>s===null||se(s,t,r));case"ObjectExpression":return e.properties.every(s=>s.type==="Property"&&(!s.computed||se(s.key,t,r))&&se(s.value,t,r));case"BinaryExpression":case"LogicalExpression":return se(e.left,t,r)&&se(e.right,t,r);case"ConditionalExpression":return se(e.test,t,r)&&se(e.consequent,t,r)&&se(e.alternate,t,r);default:return!1}}var Sf=e=>{let t=d(e);if(!t.isAssertOrTestFile)return;let r=y(t,{trackHooks:!0});e.on("CallExpression",s=>{r.update(s);let n=R(s,t,r);if(!n||s.arguments.some(l=>l.type==="SpreadElement"))return;let{method:o}=n,[i,a]=s.arguments,c=!1;if(o==="ok"||o==="ifError"?c=se(i,e):yf.has(o)?c=se(i,e)&&se(a,e):hf.has(o)&&(c=se(i,e)&&ot(S(a))),!!c)return{node:s,messageId:Ln}}),e.onExit("CallExpression",s=>{r.leave(s)})},bf={create:Sf,meta:{type:"problem",docs:{description:"Disallow assertions with constant outcomes.",recommended:"unopinionated"},schema:[],messages:gf,languages:["js/js"]}},Gn=bf;var Bn="no-done-callback",xf={[Bn]:"Use `async`/`await` or return a Promise instead of the `{{name}}` callback parameter."},kf=e=>{let t=d(e);if(!t.isTestFile)return;let r=y(t,{trackHooks:!0}),s=new Set;e.on("CallExpression",n=>{let o=r.isSubtestCall(n),i=N(n,r.isContextReceiver);r.update(n);let a=b(n,t);if(a?.kind!=="test"&&a?.kind!=="hook"&&!o&&!i)return;let c=i?pe(n.arguments[0],e):ie(n,e,t);if(!c||s.has(c)||ke(c.params)<2)return;s.add(c);let l=Ue(c.params,1);return{node:l,messageId:Bn,data:{name:l.type==="Identifier"?l.name:"done"}}}),e.onExit("CallExpression",n=>{r.leave(n)})},Cf={create:kf,meta:{type:"suggestion",docs:{description:"Disallow callback (`done`) parameters in tests and hooks.",recommended:!1},schema:[],messages:xf,languages:["js/js"]}},Hn=Cf;var qn="no-duplicate-assertions",Tf={[qn]:"Duplicate adjacent assertion."};function If(e){return e.isStrict&&je.has(e.method)?je.get(e.method):e.method}function vf(e,t,r,s){let{node:n,isAwaited:o}=e,i=R(n,r,s);if(!i)return;let a=n.arguments.map(c=>c.type==="SpreadElement"?`...${t.sourceCode.getText(m(c.argument))}`:t.sourceCode.getText(m(c)));return JSON.stringify([o,If(i),a])}function wf(e){if(e.type!=="ExpressionStatement")return;let t=S(e.expression);if(t.type==="CallExpression")return{node:t,isAwaited:!1};if(t.type==="AwaitExpression"){let r=S(t.argument);if(r.type==="CallExpression")return{node:r,isAwaited:!0}}}var Af=e=>{let t=d(e);if(!t.isAssertOrTestFile)return;let r=y(t),s=new WeakSet;e.on("CallExpression",n=>{let o=b(n,t)?.kind==="test"||r.isSubtestCall(n);r.update(n);let i=v(n);!o||!i||i.body.type!=="BlockStatement"||s.add(i.body)}),e.on(j,n=>{let o=D(n,e,t);P(o,t,e)!=="test"||n.body.type!=="BlockStatement"||s.add(n.body)}),e.onExit("BlockStatement",function*(n){if(!s.has(n))return;let o;for(let i of n.body){let a=wf(i),c=a&&vf(a,e,t,r);if(!c){o=void 0;continue}c===o&&(yield{node:i,messageId:qn}),o=c}}),e.onExit("CallExpression",n=>{r.leave(n)})},Rf={create:Af,meta:{type:"suggestion",docs:{description:"Disallow adjacent duplicate assertions.",recommended:"unopinionated"},schema:[],messages:Tf,languages:["js/js"]}},Un=Rf;var Vn="no-duplicate-hooks",Of={[Vn]:"Duplicate `{{name}}` hook in the same scope."},jf=e=>{let t=d(e);if(!t.isTestFile)return;let r=new Map,s=y(t,{trackHooks:!0});e.on("CallExpression",n=>{let o=N(n,s.isContextReceiver);s.update(n);let i=b(n,t),a=o?xe(n):i?.kind==="hook"?i.name:void 0;if(a===void 0)return;let c=O(n),l=r.get(c);if(l||(l=new Set,r.set(c,l)),l.has(a))return{node:n,messageId:Vn,data:{name:a}};l.add(a)}),e.onExit("CallExpression",n=>{s.leave(n)})},Pf={create:jf,meta:{type:"suggestion",docs:{description:"Disallow duplicate hooks within the same scope.",recommended:!0},schema:[],messages:Of,languages:["js/js"]}},Wn=Pf;function Ne(e,t){let r=W(e,"skip");if(r===void 0)return!1;let s=B(r.value,t.sourceCode.getScope(r.value));return s!==null&&!!s.value}function ye(e,t,r){return t?.modifiers.some(s=>s.name==="skip")||Ne(F(e),r)}function Xe(e,t){if(t.size===0)return!1;for(let r=e;r;r=r.parent)if(t.has(r))return!0;return!1}var $n="no-duplicate-mock-timers-enable",Mf={[$n]:"`mock.timers.enable()` is already active on this mock tracker. Call `reset()` before enabling mock timers again."},Df=Symbol("global receiver"),_f=Symbol("root context receiver");function Tt(e){if(e.type==="Identifier")return e.name;if(e.type==="Literal"&&typeof e.value=="string")return e.value}function Nf(e,t,r,s){let n=m(e);if(n.type!=="MemberExpression"||n.computed||n.optional||Tt(n.property)!=="mock")return;let o=m(n.object);if(M(o,s))return t.currentContextVariable()??_f;if(o.type!=="Identifier")return;let i=C(s.sourceCode.getScope(o),o);if(!(!i||!t.isContextIdentifier(o)&&!r.has(i)))return i}function Kn(e,t,r,s){let n=m(e);return J(n,s)?Df:Nf(n,t,r,s)}function Ff(e,t,r,s){let n=m(e);if(!(n.type!=="MemberExpression"||n.computed||n.optional||Tt(n.property)!=="timers"))return Kn(n.object,t,r,s)}function Lf(e,t,r,s){if(e.optional)return;let n=m(e.callee);if(n.type!=="MemberExpression"||n.computed||n.optional)return;let o=Tt(n.property);if(o==="enable"||o==="reset"){let i=Ff(n.object,t,r,s);if(i)return{receiver:i,method:o}}if(o==="reset"){let i=Kn(n.object,t,r,s);if(i)return{receiver:i,method:o}}}function Gf(e,t){let r=m(e.callee),s=r.type==="MemberExpression"&&!r.computed&&!r.optional?Tt(r.property):void 0;if(!s||!Ce.has(s))return;let n=m(r.object);return n.type==="Identifier"&&t.isContextIdentifier(n)?V(e):void 0}function Bf(e,t){let r=new Set,s=new Set,n=o=>{if(!(!o||s.has(o))){if(s.add(o),t.has(o)){for(let i of t.get(o))r.add(i);return}for(let i of o.prevSegments)n(i)}};for(let o of e.prevSegments)n(o);return r}function Hf(e){let{parent:t}=e;return t?.type==="PropertyDefinition"&&t.static&&t.value===e&&!I(e)}function ut(e){return e.type==="StaticBlock"||Hf(e)}function qf(e){return e.type==="Program"?!0:ut(e)&&O(e)===void 0}var Uf=e=>{let{sourceCode:t}=e,r=d(e);if(!r.isTestFile)return;let s=y(r,{trackHooks:!0}),n=new WeakSet,o=new Set,i=new Set,a=[],c=f=>{let g=b(f,r);return((g?.kind==="test"||g?.kind==="suite")&&g.modifiers.every(k=>_.has(k.name))||s.isContextIdentifier(K(f)))&&ye(f,g,e)},l=f=>{let g=new Set;for(let h=f.parent;h;h=h.parent){if(!I(h)||g.has(h))continue;g.add(h);let k=Oe(h),T=k&&v(k,r)===h?k:void 0,x=T??D(h,e,r);if(x&&c(x))return!0;x&&!T&&(h=x)}return!1},u=(f,g)=>{let h=Gf(f,s);if(!h||g||O(f)!==s.currentCallback())return;let k=q(h.params);if(k?.type==="Identifier"){let T=C(t.getScope(k),k);T&&i.add(T)}n.add(h)},p=f=>{let g=b(f,r),h=v(f);h&&c(f)&&o.add(h);let k=Xe(f,o)||h!==void 0&&l(f);k&&h&&o.add(h),u(f,k),h&&g?.kind==="suite"&&g.modifiers.every(x=>_.has(x.name))&&!k&&!o.has(h)&&n.add(h),s.update(f);let T=s.currentCallback();T&&!k&&!o.has(T)&&n.add(T)};e.on("onCodePathStart",(f,g)=>{let h=qf(g),k=a.at(-1),T=new Set;if(ut(g)&&k?.isTracked)for(let x of k.activeSegments)for(let A of k.enabledReceiversBySegment.get(x))T.add(A);a.push({node:g,isTracked:h||n.has(g)||ut(g)&&n.has(O(g)),isLoadTime:h,activeSegments:new Set,enabledReceiversBySegment:new Map([[f.initialSegment,T]]),seedReceivers:new Set(T)})}),e.on("onCodePathEnd",f=>{let g=a.pop(),h=a.at(-1);if(!ut(g.node)||!g.isTracked||!h?.isTracked||f.returnedSegments.length===0)return;let k=new Set;for(let A of f.returnedSegments)for(let H of g.enabledReceiversBySegment.get(A)??[])k.add(H);let T=k.difference(g.seedReceivers),x=g.seedReceivers.difference(k);for(let A of h.activeSegments){let H=h.enabledReceiversBySegment.get(A);h.enabledReceiversBySegment.set(A,H.difference(x).union(T))}}),e.on("onCodePathSegmentStart",f=>{let g=a.at(-1);if(!g?.isTracked)return;let h=g.enabledReceiversBySegment.get(f)??Bf(f,g.enabledReceiversBySegment);g.enabledReceiversBySegment.set(f,h),g.activeSegments.add(f)}),e.on("onCodePathSegmentEnd",f=>{a.at(-1)?.activeSegments.delete(f)}),e.on("CallExpression",f=>{p(f);let g=a.at(-1);if(!g?.isTracked||!ut(g.node)&&!g.isLoadTime&&O(f)!==g.node)return;let h=Lf(f,s,i,r);if(!h)return;let k=!1;for(let T of g.activeSegments){let x=g.enabledReceiversBySegment.get(T);h.method==="enable"?(k||=x.has(h.receiver),x.add(h.receiver)):x.delete(h.receiver)}if(k)return{node:f,messageId:$n}}),e.onExit("CallExpression",f=>{s.leave(f)})},Vf={create:Uf,meta:{type:"problem",docs:{description:"Disallow enabling mock timers more than once without resetting them.",recommended:"unopinionated"},schema:[],messages:Mf,languages:["js/js"]}},zn=Vf;var Xn="no-duplicate-plan/duplicate-call",Yn="no-duplicate-plan/plan-option",Wf={[Xn]:"Do not call `{{context}}.plan()` more than once in the same test.",[Yn]:"Do not call `{{context}}.plan()` when this test already has a `plan` option."};function $f(e){let t=m(e.callee);if(e.optional!==!0&&t.type==="MemberExpression"&&!t.computed&&t.optional!==!0&&t.property.type==="Identifier"&&t.property.name==="plan"){let r=m(t.object);return r.type==="Identifier"?r:void 0}}function Kf(e,t){let r=m(e.callee);return e.optional!==!0&&r.type==="MemberExpression"&&!r.computed&&r.optional!==!0&&r.property.type==="Identifier"&&r.property.name==="plan"&&M(m(r.object),t)}function or(e,t){return C(e.getScope(t),t)}function zf(e){return e!==void 0&&e.kind==="test"&&e.modifiers.every(t=>_.has(t.name))}var Xf=e=>{let t=d(e);if(!t.isTestFile)return;let{sourceCode:r}=e,s=[],n=new WeakSet,o=i=>{let a=K(i);if(a===void 0)return s.length>0&&He(i,t);let c=or(r,a);return c!==void 0&&s.some(l=>l.contextVariable===c)};e.on("CallExpression",i=>{let a=b(i,t);if(zf(a)||o(i)){if(ye(i,a,e)){let T=v(i);T&&n.add(T);return}let g=q(v(i)?.params),h=St(i,e),k={node:i,contextName:g?.name,contextVariable:g?or(r,g):void 0,hasPlan:h,hasPlanOption:h};k.contextKey=k.contextVariable??k,s.push(k);return}let u=$f(i),p=Kf(i,t);if(u===void 0&&!p||Xe(i,n))return;let f=u?or(r,u):s.at(-1)?.contextKey;if(f!==void 0)for(let g=s.length-1;g>=0;g-=1){let h=s[g];if(h.contextKey===f){if(h.hasPlan)return{node:i,messageId:h.hasPlanOption?Yn:Xn,data:{context:h.contextName??r.getText(m(m(i.callee).object))}};h.hasPlan=!0;break}}}),e.onExit("CallExpression",i=>{s.at(-1)?.node===i&&s.pop()})},Yf={create:Xf,meta:{type:"problem",docs:{description:"Disallow setting a test plan more than once in the same test.",recommended:"unopinionated"},schema:[],messages:Wf,languages:["js/js"]}},Jn=Yf;var Qn="no-expect-failure-without-reason",Jf={[Qn]:"Give `expectFailure` a reason string instead of `{{value}}` explaining why."};function Qf(e){return e===void 0||e===!1}function Zf(e){return typeof e=="string"?e!=="":typeof e=="function"||e instanceof RegExp?!0:typeof e=="object"&&e!==null&&Object.keys(e).length>0}var em=e=>{let{sourceCode:t}=e,r=d(e);if(!r.isTestFile)return;let s=y(r,{trackHooks:!0});e.on("CallExpression",n=>{let o=s.isSubtestCall(n);s.update(n);let i=b(n,r);if(!i&&!o||i?.kind==="hook"||i?.hasExpectedFailure||i?.modifiers.some(u=>!_.has(u.name)))return;let a=W(F(n),"expectFailure"),c=a&&m(a.value);if(!c)return;let l=B(c,e.sourceCode.getScope(c));if(!(l===null||Qf(l.value)||Zf(l.value)))return{node:a,messageId:Qn,data:{value:t.getText(c)}}})},tm={create:em,meta:{type:"suggestion",docs:{description:"Require a reason when marking a test or suite as expected to fail.",recommended:!0},schema:[],messages:Jf,languages:["js/js"]}},Zn=tm;var eo="no-export",rm={[eo]:"Do not export from a test file."},sm=e=>{if(!d(e).isTestFile)return;let r=s=>({node:s,messageId:eo});e.on("ExportNamedDeclaration",s=>{if(!(!s.declaration&&!s.source&&s.specifiers.length===0))return r(s)}),e.on("ExportDefaultDeclaration",r),e.on("ExportAllDeclaration",r),e.on("TSExportAssignment",r),e.on("TSNamespaceExportDeclaration",r)},nm={create:sm,meta:{type:"suggestion",docs:{description:"Disallow exports from test files.",recommended:!0},schema:[],messages:rm,languages:["js/js"]}},to=nm;var so="no-identical-assertion-arguments/always-passes",no="no-identical-assertion-arguments/always-fails",om={[so]:"Both arguments are the same, so this assertion always passes.",[no]:"Both arguments are the same, so this assertion always fails."},im=new Set(["equal","strictEqual","deepEqual","deepStrictEqual","partialDeepStrictEqual"]),am=new Set(["notEqual","notStrictEqual","notDeepEqual","notDeepStrictEqual"]),cm=new Set(["deepEqual","deepStrictEqual","notDeepEqual","notDeepStrictEqual","partialDeepStrictEqual"]);function ro(e){return e?.type==="Literal"&&!!e.regex}var lm=e=>{let t=d(e);if(!t.isAssertOrTestFile)return;let r=y(t,{trackHooks:!0});e.on("CallExpression",s=>{r.update(s);let n=R(s,t,r);if(!n)return;let o=am.has(n.method);if(!o&&!im.has(n.method))return;let[i,a]=s.arguments;if(!(!i||!a||i.type==="SpreadElement"||a.type==="SpreadElement")&&Re(i,a)&&!(!cm.has(n.method)&&ro(i)&&ro(a)))return{node:s,messageId:o?no:so}}),e.onExit("CallExpression",s=>{r.leave(s)})},um={create:lm,meta:{type:"problem",docs:{description:"Disallow comparing a value to itself in an assertion.",recommended:"unopinionated"},schema:[],messages:om,languages:["js/js"]}},oo=um;var io="no-identical-title/duplicate",pm={[io]:"Test title is already used by another test in the same scope."},fm=e=>{let t=d(e);if(!t.isTestFile)return;let r=[new Set],s=new WeakSet;e.on("CallExpression",o=>{let i=P(o,t,e);if(!i)return;let a=i==="hook"?V(o):v(o);if(a&&s.add(a),i==="hook")return;let c=fe(o,e);if(!c)return;let l=me(c,e);if(l===void 0||l==="")return;let u=r.at(-1);if(u.has(l))return{node:c,messageId:io};u.add(l)});let n=o=>s.has(o)||ms(o,e,t);e.on(j,o=>{n(o)&&r.push(new Set)}),e.onExit(j,o=>{n(o)&&r.pop()})},mm={create:fm,meta:{type:"problem",docs:{description:"Disallow identical test titles within the same scope.",recommended:"unopinionated"},schema:[],messages:pm,languages:["js/js"]}},ao=mm;import he from"node:path";var co="no-import-test-files",dm=process.platform==="darwin"||process.platform==="win32",gm=new Set(["js","mjs","cjs","jsx","ts","mts","cts","tsx"]),ym={[co]:"Do not import a test file. The Node.js test runner may execute it twice."};function hm(e){if(e=e.split(/[#?]/,1)[0],!/%2f|%5c/i.test(e)&&(e=e.replaceAll("\\","/"),!(!e.startsWith("./")&&!e.startsWith("../"))))try{return he.posix.normalize(decodeURIComponent(e))}catch{}}function Em(e,t,r){let s=hm(e);if(!s)return;let n=t&&t!=="<input>"&&t!=="<text>"?he.dirname(he.resolve(r,t)):r,o=he.resolve(n,s),i=he.relative(r,o);if(!(i===".."||i.startsWith(`..${he.sep}`)||he.isAbsolute(i)))return i.replaceAll(he.sep,"/")}function ir(e){return dm?e.toLowerCase():e}function Sm(e,t,r){let s=Em(e,t,r);if(!s)return!1;let n=s.split("/");if(n.includes("node_modules"))return!1;for(let a of n)if(a.startsWith("."))return!1;let o=he.posix.extname(s).slice(1);if(!gm.has(ir(o)))return!1;let i=ir(he.posix.basename(s,`.${o}`));return n.some(a=>ir(a)==="test")||i==="test"||i.startsWith("test-")||i.endsWith(".test")||i.endsWith("_test")||i.endsWith("-test")}function bm(e){return nt(m(e))}var xm=e=>{if(!d(e).isTestFile)return;let t=e.physicalFilename??e.filename,r=(s,n)=>{let o=bm(n);if(!(!o||!Sm(o,t,e.cwd)))return{node:s,messageId:co}};e.on("ImportDeclaration",s=>{if(s.importKind!=="type")return r(s,s.source)}),e.on("ExportNamedDeclaration",s=>{if(!(!s.source||s.exportKind==="type"))return r(s,s.source)}),e.on("ExportAllDeclaration",s=>{if(s.exportKind!=="type")return r(s,s.source)}),e.on("ImportExpression",s=>r(s,s.source))},km={create:xm,meta:{type:"problem",docs:{description:"Disallow imports of Node.js test files.",recommended:"unopinionated"},schema:[],messages:ym,languages:["js/js"]}},lo=km;var uo="no-deep-equal-with-primitive",Cm=new Map([["deepEqual","equal"],["deepStrictEqual","strictEqual"],["notDeepEqual","notEqual"],["notDeepStrictEqual","notStrictEqual"]]),Tm=e=>{let t=d(e);if(!t.isAssertOrTestFile)return;let r=y(t,{trackHooks:!0});e.on("CallExpression",s=>{r.update(s);let n=R(s,t,r);if(!n)return;let{method:o}=n,i=Cm.get(o);if(!i)return;let[a,c]=s.arguments;if(!a||!c||!_e(a,e)&&!_e(c,e))return;let{callee:l}=s,u={node:s,messageId:uo,data:{method:o}},p=!n.isStrict&&(o==="deepEqual"||o==="notDeepEqual");return l.type==="MemberExpression"&&!p&&(u.fix=f=>f.replaceText(l.property,i)),u}),e.onExit("CallExpression",s=>{r.leave(s)})},Im={create:Tm,meta:{type:"suggestion",docs:{description:"Disallow `deepEqual`/`deepStrictEqual` (and their `notDeep*` variants) when comparing with primitives.",recommended:"unopinionated"},fixable:"code",schema:[],messages:{[uo]:"Avoid using `{{method}}` with a primitive. Use the non-deep equality equivalent instead."},languages:["js/js"]}},po=Im;var mo="no-incorrect-strict-equal",vm=new Map([["equal","deepEqual"],["strictEqual","deepStrictEqual"],["notEqual","notDeepEqual"],["notStrictEqual","notDeepStrictEqual"]]);function fo(e){let t=m(e);return t.type==="ObjectExpression"||t.type==="ArrayExpression"}var wm=e=>{let t=d(e);if(!t.isAssertOrTestFile)return;let r=y(t,{trackHooks:!0});e.on("CallExpression",s=>{r.update(s);let n=R(s,t,r);if(!n)return;let o=vm.get(n.method);if(!o)return;let[i,a]=s.arguments;if(!i||!a||!fo(i)&&!fo(a))return;let{callee:c}=s,l={node:s,messageId:mo,data:{method:n.method,replacement:o}};return c.type==="MemberExpression"&&!_e(i,e)&&!_e(a,e)&&(l.fix=u=>u.replaceText(c.property,o)),l}),e.onExit("CallExpression",s=>{r.leave(s)})},Am={create:wm,meta:{type:"suggestion",docs:{description:"Disallow `strictEqual`/`equal` (and their `not*` variants) when comparing with an object or array literal.",recommended:"unopinionated"},fixable:"code",schema:[],messages:{[mo]:"Avoid using `{{method}}` with an object or array literal. Use `{{replacement}}` to compare by structure instead."},languages:["js/js"]}},go=Am;var So="no-unawaited-promise-assertion",bo=new Set(["then","catch","finally"]),Rm=new Map([["then",1],["catch",0]]),Om=new Set(["rejects","doesNotReject"]),cr=new Set(["setTimeout","setImmediate","queueMicrotask"]),jm=new Set(["node:timers","timers"]),Pm={[So]:"Assertion in a floating `{{method}}()` callback is not awaited by the test. Await or return the Promise chain."};function yo(e){let t=[];for(e=S(e);e?.type==="CallExpression";){let r=S(e.callee);if(r?.type!=="MemberExpression"||r.computed||r.property.type!=="Identifier")break;if(!bo.has(r.property.name))return t.length>0&&S(r.object)?.type==="CallExpression"?[]:t;t.push({node:e,method:r.property.name}),e=S(r.object)}return t}var Mm=new Set(["all","allSettled","race","any"]);function xo(e){e=S(e);let t=S(e?.callee);if(t?.type!=="MemberExpression"||t.computed||t.property.type!=="Identifier"||!Mm.has(t.property.name)||S(t.object)?.name!=="Promise")return;let r=m(e.arguments[0]);return r?.type==="ArrayExpression"?{method:t.property.name,array:r}:void 0}function ko(e){return e.elements.filter(Boolean).map(t=>S(t)).flatMap(t=>t?.type==="ArrayExpression"?ko(t):[t])}function Co(e){let t=xo(e);return[yo(e),...t?ko(t.array).map(r=>yo(r)):[]].filter(r=>r.length>0)}function Dm(e,t){let r=xo(e);return!r||(r.method==="all"||r.method==="allSettled"&&!t)&&r.array.elements.every(s=>S(s)?.type!=="ArrayExpression")}function Ye(e){return!!e&&I(e)}function To(e){let{method:t}=e;return(t==="then"?[0,1]:[0]).map(s=>m(e.node.arguments[s])).filter(s=>Ye(s))}function Io(e){let{callee:t}=e;if(t.type==="MemberExpression"&&t.object.type==="MemberExpression"&&!t.object.computed&&t.object.property.type==="Identifier"&&t.object.property.name==="assert")return t.object.object}function vo(e){if(e=S(e),e?.type!=="MemberExpression")return e;let t=vo(e.object);return t===e.object?e:{...e,object:t}}function _m(e){let t=vo(e.callee);return t===e.callee?e:{...e,callee:t}}function Nm(e,t,r,s){let n=Io(e);return n?M(n,s)?!0:n.type!=="Identifier"?!1:C(r.getScope(n),n)?.identifiers.some(i=>t.includes(i))===!0:!1}function wo(e,t,r,s){let n=K(e);return n===void 0?qe(e,t):C(s.getScope(n),n)?.identifiers.some(i=>r.includes(i))===!0}function Fm(e,t,r,s){if(xe(e)===void 0)return!1;let n=m(m(e.callee).object);return M(n,t)?!0:n.type!=="Identifier"?!1:C(s.getScope(n),n)?.identifiers.some(i=>r.includes(i))===!0}function It(e,t){return C(t.getScope(e),e)?.defs.some(s=>s.type==="ImportBinding")===!0}function Lm(e,t){let r=ee(e.callee)?.root;return!!r&&It(r,t)}function Gm(e){return e.modifiers.every(t=>_.has(t.name))}function Bm(e,t){let{callee:r}=e;for(;r.type==="MemberExpression";)r=r.object;if(r.type==="Identifier"&&(t.assertNamed.has(r.name)||t.assertNamespace.has(r.name)))return r}function ho(e,t,r){if(e.length===0)return ar;let s=C(r.getScope(t),t);if(s===null)return ar;for(let n=e.length-1;n>=0;n-=1){let o=e[n];if(o.has(s))return o.get(s)??Ao}return ar}var ar=Symbol("not a destructured assert binding"),Ao=Symbol("the destructured assert object");function Hm(e,t,r,s){let{contextParameters:n,assertBindings:o}=s,i=_m(e),a=te(i,t);if(!a)return Kt(i,{getMethodName(l){let u=ho(o,l,r);return typeof u=="string"?u:void 0},isAssertObject:l=>ho(o,l,r)===Ao});if(Io(i))return Nm(i,n,r,t)?a:void 0;let c=Bm(i,t);return c&&It(c,r)?a:void 0}function Ro(e,t){let r=e;for(let{parent:s}=e;s&&r!==t;r=s,s=s.parent)if(s.type==="TryStatement"&&s.block===r&&s.handler)return!0;return!1}function qm(e){return oe(e.parent)?.type==="AwaitExpression"}function Oo(e){let t=Rm.get(e.method),r=t===void 0?void 0:m(e.node.arguments[t]);return Ye(r)||r?.type==="Identifier"&&r.name!=="undefined"||r?.type==="MemberExpression"||r?.type==="CallExpression"}function Um(e,t){let r=e;for(;r.parent&&r!==t;){let{parent:s}=r;if(ne(s)){r=s;continue}if(s.type==="MemberExpression"&&s.object===r&&s.parent?.type==="CallExpression"&&s.parent.callee===s&&!s.computed&&s.property.type==="Identifier"&&bo.has(s.property.name)){let n={node:s.parent,method:s.property.name};if(Oo(n))return!0;r=s.parent;continue}break}return!1}function Vm(e,t){let{imports:r,sourceCode:s}=t,n=Hm(e,r,s,t);if(!n)return;let o=Om.has(n.method),i=Ro(e,t.boundary);if(!(o&&(!t.assertionsOnly&&Um(e,t.boundary)||qm(e)&&i)||!o&&i))return{node:e,type:"Assertion"}}function lr(e,t){let{imports:r,contextParameters:s,sourceCode:n,visitorKeys:o}=t;if(e=m(e),!e)return[];if(I(e))return[];let i=[];if(e.type==="CallExpression"){let a=Vm(e,t);a&&i.push(a)}e.type==="CallExpression"&&wo(e,r,s,n)&&i.push({node:e,type:"Subtest"}),e.type==="ThrowStatement"&&!Ro(e,t.boundary)&&i.push({node:e,type:"Throw"});for(let a of o[e.type]??[]){if(a==="value"&&Po(e))continue;let c=e[a];for(let l of Array.isArray(c)?c:[c])l?.type&&i.push(...lr(l,t))}return i}function jo(e,t){return[...e.params.flatMap(r=>lr(r,{...t,boundary:r})),...e.generator?[]:lr(e.body,{...t,boundary:e.body})]}function Po(e){return(e.type==="PropertyDefinition"||e.type==="AccessorProperty")&&!e.static}function Wm(e,t,r,s){return e.flatMap((n,o)=>To(n).flatMap(i=>{let a=jo(i,{...t,assertionsOnly:r}).filter(l=>r?l.type==="Assertion":l.type!=="Assertion"),c=e.slice(0,o).some(l=>Oo(l));return!r&&c&&(a=a.filter(l=>l.type==="Subtest")),r&&(a=a.slice(0,1)),a.map(l=>({node:l.node,messageId:s,data:{method:n.method,activity:l.type,scheduler:`${n.method}()`}}))}))}function Mo(e){let t=new Map,r=new Set;for(let s of e.ast.body)if(!(s.type!=="ImportDeclaration"||!jm.has(s.source.value)))for(let n of s.specifiers)n.type==="ImportSpecifier"&&cr.has(X(n))?t.set(n.local.name,X(n)):(n.type==="ImportNamespaceSpecifier"||n.type==="ImportDefaultSpecifier")&&r.add(n.local.name);return{named:t,namespaces:r}}function Eo(e,t){let r=C(e.getScope(t),t);return!r||r.defs.length===0}function $m(e,t,r){let s=S(e.callee);if(s.type==="Identifier"){if(cr.has(s.name)&&Eo(r,s))return s.name;if(t.named.has(s.name)&&It(s,r))return t.named.get(s.name)}let n=s.type==="MemberExpression"?S(s.object):void 0;if(s.type==="MemberExpression"&&!s.computed&&n?.type==="Identifier"&&s.property.type==="Identifier"&&cr.has(s.property.name)&&((n.name==="globalThis"||n.name==="global")&&Eo(r,n)||t.namespaces.has(n.name)&&It(n,r)))return s.property.name}function Km(e,t,r){for(let s=e.parent;s&&s!==t;s=s.parent)if(s.type==="NewExpression"&&s.callee.type==="Identifier"&&s.callee.name==="Promise"&&(C(r.getScope(s.callee),s.callee)?.defs.length??0)===0)return s}function zm(e,t){let r=e;for(let s=e.parent;s&&s!==t;r=s,s=s.parent)if(Po(s)&&s.value===r)return!0;return!1}function Do(e,t,r,s){let n=$m(e,r,s),o=m(e.arguments[0]);if(!n||!Ye(o))return;let i=Km(e,t,s),a=i&&m(i.arguments[0]),c=O(e),l=c===a;if((c===t||l)&&!(l&&Xm(i)))return{callback:o,scheduler:n}}function Xm(e){for(;ne(e.parent)||e.parent?.type==="MemberExpression"&&e.parent.object===e||e.parent?.type==="CallExpression"&&e.parent.callee===e;)e=e.parent;return Y(e)===void 0}function Ym(e,t){if(e=m(e),e?.type!=="ObjectExpression")return!1;for(let r=e.properties.length-1;r>=0;r-=1){let s=e.properties[r];if(s.type==="SpreadElement")return!1;if(s.type==="Property"&&!s.computed&&(s.key.type==="Identifier"&&s.key.name==="wait"||s.key.type==="Literal"&&s.key.value==="wait"))return!!B(s.value,t.getScope(s.value))?.value}return!1}function Jm(e,t,r,s){if(e.body.type!=="BlockStatement")return!1;for(let n of e.body.body){if(n.type==="ReturnStatement"||n.type==="ThrowStatement")return!1;let o=n.type==="ExpressionStatement"?m(n.expression):void 0;if(o?.type!=="CallExpression"||o.callee.type!=="MemberExpression"||o.callee.computed||o.callee.property.type!=="Identifier"||o.callee.property.name!=="plan")continue;let i=m(o.callee.object);if((t&&i.type==="Identifier"&&Qm(i,t,r)||M(i,s))&&Ym(o.arguments[1],r))return!0}return!1}function Qm(e,t,r){return C(r.getScope(e),e)?.identifiers.includes(t)===!0}function Zm(e,t,r,s){let n=b(e,t);if(n){let i=n.kind==="hook";if(n.kind!=="test"&&!i||!i&&!Gm(n)||!Lm(e,s))return;let a=i?V(e):v(e);return Ye(a)&&ke(a.params)<2?a:void 0}if(Fm(e,t,r,s)){let i=V(e);return Ye(i)&&ke(i.params)<2?i:void 0}if(!wo(e,t,r,s))return;let o=v(e);return Ye(o)&&ke(o.params)<2?o:void 0}function ed(e,t){return t.generator&&_o(e,t)}function _o(e,t){for(let r=e.parent;r&&r!==t;r=r.parent)if(r===t.body)return!0;return!1}function td(e,t){let r=t.params[0];if(r?.type!=="AssignmentPattern")return!1;for(let s=e;s&&s!==t;s=s.parent)if(s===r.right)return!0;return!1}function ur(e,t){return zm(e,t)||ed(e,t)||td(e,t)}function rd(e,t){return O(e)===t&&!ur(e,t)}function No(e,t){let{sourceCode:r}=e,s=[],n=[],o=[],i=(c,l)=>{let u=q(l.params);s.push({node:c,callback:l,contextParameter:u,hasWaitPlan:Jm(l,u,r,t)}),u&&n.push(u),o.push(We(l,t))},a=c=>{if(s.at(-1)?.node!==c)return;s.pop().contextParameter&&n.pop(),o.pop()};return e.onExit("CallExpression",a),e.on(j,c=>{let l=P(D(c,e,t),t,e);(l==="test"||l==="hook")&&ke(c.params)<2&&i(c,c)}),e.onExit(j,a),{contextParameters:n,assertBindings:o,activeFrame:()=>s.at(-1),enter(c){let l=s.at(-1),u=!l||rd(c,l.callback)?Zm(c,t,n,r):void 0;return u?(i(c,u),!0):!1}}}function Fo(e){let t=d(e),{sourceCode:r}=e,s=Mo(r),n=new WeakSet,o=No(e,t),{contextParameters:i,assertBindings:a}=o;return e.on("CallExpression",c=>{if(o.enter(c))return;let l=o.activeFrame();if(!l||l.hasWaitPlan||ur(c,l.callback))return;let u=Do(c,l.callback,s,r);if(u&&n.add(u.callback),!(!Y(c)||O(c)!==l.callback))for(let p of Co(c))for(let f of p)for(let g of To(f))n.add(g)}),c=>n.has(O(c))}function pr(e,{assertionsOnly:t=!1,messageId:r=So}={}){let s=d(e);if(!s.isTestFile)return;let{sourceCode:n}=e,{visitorKeys:o}=n,i=Mo(n),a=No(e,s),{contextParameters:c,assertBindings:l}=a;e.on("CallExpression",u=>{if(a.enter(u))return;let p=a.activeFrame(),f=p?.callback;if(!f||ur(u,f)||p.hasWaitPlan)return;if(!t){let x=Do(u,f,i,n);if(x)return jo(x.callback,{imports:s,contextParameters:c,assertBindings:l,sourceCode:n,visitorKeys:o}).map(A=>({node:A.node,messageId:r,data:{activity:A.type,scheduler:`${x.scheduler}()`}}))}if(O(u)!==f)return;let g=Y(u);if(!g)return;let h=Co(u);if(h.length===0)return;let k={imports:s,contextParameters:c,assertBindings:l,sourceCode:n,visitorKeys:o},T=h.flatMap(x=>Wm(x,k,t,r));if(T.length!==0)return g.canAwait&&f.async&&_o(u,f)&&!ae(u,f)&&Dm(u,t)&&(T[0].fix=x=>x.insertTextBefore(u,"await ")),T})}var sd=e=>{pr(e,{assertionsOnly:!0})},nd={create:sd,meta:{type:"problem",docs:{description:"Disallow assertions inside unawaited Promise callbacks.",recommended:"unopinionated"},fixable:"code",schema:[],messages:Pm,languages:["js/js"]}},Lo=nd;var Go="no-late-test-activity",od={[Go]:"{{activity}} in a detached `{{scheduler}}` callback can run after the test or hook has finished."},id=e=>{pr(e,{messageId:Go})},ad={create:id,meta:{type:"problem",docs:{description:"Disallow test activity inside detached asynchronous callbacks.",recommended:"unopinionated"},fixable:"code",schema:[],messages:od,languages:["js/js"]}},Bo=ad;var Ho="no-loop-static-title",cd={[Ho]:"This title is static but generated in a loop, so every iteration registers the same title. Include the loop variable so each title is unique."},ld=new Set(["map","forEach","flatMap"]);function ud(e,t){let{callee:r}=e;return r.type==="MemberExpression"&&!r.computed&&r.property.type==="Identifier"&&ld.has(r.property.name)&&e.arguments.includes(t)}function pd(e){let t=e.parent;for(;t;){if(Ie(t))return!0;if(I(t))return t.parent?.type==="CallExpression"&&ud(t.parent,t);t=t.parent}return!1}var fd=e=>{let t=d(e);if(!t.isTestFile)return;let r=y(t);e.on("CallExpression",s=>{let n=r.isSubtestCall(s);r.update(s);let o=b(s,t);if(!n&&o?.kind!=="test"&&o?.kind!=="suite")return;let i=fe(s,e);if(me(i,e)!==void 0&&pd(s))return{node:i,messageId:Ho}}),e.onExit("CallExpression",s=>{r.leave(s)})},md={create:fd,meta:{type:"problem",docs:{description:"Disallow a static test or suite title inside a loop.",recommended:"unopinionated"},schema:[],messages:cd,languages:["js/js"]}},qo=md;var Uo="no-misused-concurrency",dd={[Uo]:"The `concurrency` option has no effect on a test without subtests. It only controls how a suite or a test's subtests run concurrently."};function gd(e,t){let r=W(e,"concurrency");if(!r)return;let s=B(m(r.value),t.sourceCode.getScope(r.value));return s!==null&&[void 0,null,!1].includes(s.value)?void 0:r}var yd=e=>{let t=d(e);if(!t.isTestFile)return;let r=y(t),s=[];e.on("CallExpression",n=>{let o=r.isSubtestCall(n);if(o){let a=K(n),c=a?s.findLast(l=>l.contextName===a.name):s.at(-1);c&&(c.hasSubtest=!0)}let i=b(n,t)?.kind==="test";if(r.update(n),i||o){let a=F(n),c=n.arguments.at(-1)&&m(n.arguments.at(-1)),l=!v(n,t)&&(c!==a||W(a,"fn")!==void 0);s.push({node:n,contextName:r.current(),concurrencyProperty:l?void 0:gd(a,e),hasSubtest:!1})}}),e.onExit("CallExpression",n=>{if(r.leave(n),s.at(-1)?.node!==n)return;let o=s.pop();if(o.concurrencyProperty&&!o.hasSubtest)return{node:o.concurrencyProperty,messageId:Uo}})},hd={create:yd,meta:{type:"problem",docs:{description:"Disallow the `concurrency` option on a test without subtests.",recommended:"unopinionated"},schema:[],messages:dd,languages:["js/js"]}},Vo=hd;var Ko="no-misused-context-hook",Ed=new Set(["beforeEach","afterEach"]),Sd={[Ko]:"`{{name}}()` has no effect on a test without runnable subtests. It only runs around the test's subtests."};function bd(e,t){let r=m(e.callee);if(r?.type!=="MemberExpression"||r.computed||r.property.type!=="Identifier"||!Ed.has(r.property.name))return;let s=m(r.object);return s.type==="Identifier"?s:M(s,t)?mr:void 0}function xd(e,t){let r=K(e);if(r===void 0)return He(e,t)?mr:void 0;let{members:s=[]}=ee(e.callee)??{};return s.length>1?void 0:r}function fr(e,t){let r=W(F(e),"skip");if(r===void 0)return!1;let s=B(r.value,t.getScope(r.value));return s!==null&&s.value!==void 0&&s.value!==!1}var kd=new Set(["every","filter","find","findIndex","findLast","findLastIndex","flatMap","forEach","map","reduce","reduceRight","some","sort"]),Wo=new Map([["from",1]]),mr=Symbol("getTestContext receiver");function Cd(e,t){if(t?.type!=="CallExpression"||t.callee.type!=="MemberExpression"||t.callee.computed||t.callee.property.type!=="Identifier")return!1;let r=t.callee.property.name;return!kd.has(r)&&!Wo.has(r)?!1:t.arguments[Wo.get(r)??0]===e}function Td(e,t,r){return t?.type==="CallExpression"&&b(t,r)?.kind==="suite"&&v(t,r)===e}function Id(e,t){return(t?.type==="CallExpression"||t?.type==="NewExpression")&&t.callee===e}function $o(e,t,r){let s=e;for(;s&&s!==t;){let{parent:n}=s;if(I(s)&&(Cd(s,n)||Id(s,n)||Td(s,n,r))){s=n;continue}if(I(s))return!1;s=n}return s===t}var vd=e=>{let{sourceCode:t}=e,r=d(e);if(!r.isTestFile)return;let s=[],n=new Set,o=u=>{let p=q(u.params);return p?C(t.getScope(p),p):void 0},i=u=>{if(u===mr)return s.at(-1);if(u?.type!=="Identifier")return;let p=C(t.getScope(u),u);if(p)return s.findLast(f=>f.contextVariable===p)},a=u=>{if(n.size===0)return!1;for(let p=u.parent;p;p=p.parent)if(n.has(p))return!0;return!1},c=u=>{let p=xd(u,r),f=i(p);if(!(!f||!$o(u,f.callback,r)||a(u)||Ne(F(u),e)))return f},l=(u,p,f)=>p?.kind==="test"&&p.modifiers.every(g=>_.has(g.name))&&(s.length===0||f!==void 0)&&!a(u)&&p.modifiers.every(g=>g.name!=="skip")&&!Ne(F(u),e);e.on("CallExpression",u=>{let p=O(u),f=c(u);f&&!fr(u,t)&&(f.hasSubtest=!0);let g=bd(u,r),h=i(g);h&&p===h.callback&&h.hooks.push(u);let k=b(u,r);if((k?.kind==="test"||k?.kind==="suite")&&k.modifiers.every(z=>_.has(z.name))&&(k.modifiers.some(z=>z.name==="skip")||(k.kind==="suite"?fr(u,t):Ne(F(u),e)))){let z=v(u);z&&n.add(z)}let x=s.findLast(z=>$o(u,z.callback,r)),A=l(u,k,x);if(A&&x&&!fr(u,t)&&(x.hasSubtest=!0),!A&&!f)return;let H=v(u);H&&s.push({node:u,callback:H,contextVariable:o(H),hasSubtest:!1,hooks:[]})}),e.onExit("CallExpression",function*(u){if(s.at(-1)?.node!==u)return;let p=s.pop();if(!p.hasSubtest)for(let f of p.hooks){let g=m(f.callee);yield{node:f,messageId:Ko,data:{name:g.property.name}}}})},wd={create:vd,meta:{type:"problem",docs:{description:"Disallow context hooks without runnable subtests.",recommended:"unopinionated"},schema:[],messages:Sd,languages:["js/js"]}},zo=wd;var Xo="no-mock-module-after-import",Ad={[Xo]:"`mock.module()` cannot affect `{{specifier}}` because it was already imported statically."},Rd=e=>{let{sourceCode:t}=e,r=d(e);if(!r.isTestFile)return;let s=a=>a.replace(/^node:/,""),n=new Set;for(let a of t.ast.body)a.type==="ImportDeclaration"&&a.importKind!=="type"&&(a.specifiers.length===0||a.specifiers.some(l=>l.importKind!=="type"))&&typeof a.source.value=="string"&&n.add(s(a.source.value));if(n.size===0)return;let o=y(r,{trackHooks:!0}),i=a=>{let c=m(a);if(c?.type!=="MemberExpression"||c.computed||c.property.type!=="Identifier"||c.property.name!=="mock")return!1;let l=m(c.object);return o.isContextIdentifier(l)||M(l,r)};e.on("CallExpression",a=>{o.update(a)}),e.onExit("CallExpression",a=>{o.leave(a)}),e.on("CallExpression",a=>{let c=m(a.callee);if(c?.type!=="MemberExpression"||c.computed||c.property.type!=="Identifier"||c.property.name!=="module"||!J(m(c.object),r)&&!i(c.object))return;let l=me(a.arguments[0],e);if(!(l===void 0||!n.has(s(l))))return{node:a,messageId:Xo,data:{specifier:l}}})},Od={create:Rd,meta:{type:"problem",docs:{description:"Disallow mocking a module after statically importing it.",recommended:"unopinionated"},schema:[],messages:Ad,languages:["js/js"]}},Yo=Od;var Qo="no-mock-timers-destructured-import",Zo="no-mock-timers-destructured-import/namespace",jd={[Qo]:"`{{name}}` is imported directly, so `mock.timers` cannot intercept it. Call the global `{{name}}` instead.",[Zo]:"`{{name}}` is imported as a namespace, so it holds the real timer functions and `mock.timers` cannot intercept them. Call the global timer functions instead."},Pd=new Set(["node:timers","timers"]),dr=new Map([["setTimeout","setTimeout"],["clearTimeout","setTimeout"],["setInterval","setInterval"],["clearInterval","setInterval"],["setImmediate","setImmediate"],["clearImmediate","setImmediate"]]),Md=new Set(dr.values());function Jo(e){return e.type==="Identifier"&&e.name==="undefined"||e.type==="UnaryExpression"&&e.operator==="void"||e.type==="Literal"&&e.value===null}function Dd(e){let t=m(e.arguments[0]);if(!t||Jo(t))return{all:!0};if(t.type!=="ObjectExpression")return{unknown:!0};let r=W(t,"apis");if(!r)return t.properties.some(o=>o.type==="SpreadElement"||$(o)===void 0)?{unknown:!0}:{all:!0};let s=m(r.value);if(Jo(s))return{all:!0};if(s.type!=="ArrayExpression")return{unknown:!0};let n=[];for(let o of s.elements){let i=o&&m(o);if(i?.type!=="Literal"||typeof i.value!="string")return{unknown:!0};n.push(i.value)}return{list:n}}var _d=e=>{let{sourceCode:t}=e,r=d(e);if(!r.isTestFile)return;let s=[],n=[];for(let u of t.ast.body)if(!(u.type!=="ImportDeclaration"||u.importKind==="type"||!Pd.has(u.source.value)))for(let p of u.specifiers)p.type==="ImportNamespaceSpecifier"?n.push(p):p.type==="ImportSpecifier"&&p.importKind!=="type"&&dr.has(X(p))&&s.push(p);if(s.length===0&&n.length===0)return;let o=y(r,{trackHooks:!0}),i=u=>(u=m(u),u?.type==="MemberExpression"&&!u.computed&&u.property.type==="Identifier"&&u.property.name==="mock"&&(o.isContextIdentifier(m(u.object))||M(u.object,r))),a=u=>{let p=m(u);return p.type==="MemberExpression"&&!p.computed&&p.property.type==="Identifier"&&p.property.name==="timers"&&(J(p.object,r)||i(p.object))},c=new Set,l=!1;e.on("CallExpression",u=>{o.update(u);let p=m(u.callee);if(p.type==="MemberExpression"&&!p.computed&&p.property.type==="Identifier"&&p.property.name==="enable"&&a(p.object)){let f=Dd(u);if(f.all)l=!0;else if(f.list)for(let g of f.list)c.add(g)}}),e.onExit("CallExpression",u=>{o.leave(u)}),e.onExit("Program",()=>{if(!l&&c.size===0)return;let u=s.filter(f=>l||c.has(dr.get(X(f)))).map(f=>({node:f,messageId:Qo,data:{name:X(f)}})),p=[...c].some(f=>Md.has(f));if(n.length>0&&(l||p))for(let f of n)u.push({node:f,messageId:Zo,data:{name:f.local.name}});return u})},Nd={create:_d,meta:{type:"problem",docs:{description:"Disallow destructured timer imports when using `mock.timers`.",recommended:"unopinionated"},schema:[],messages:jd,languages:["js/js"]}},ei=Nd;var ti="no-nested-tests/error",Fd={[ti]:"Do not define a test or suite inside a test body. Use `t.test()` for subtests instead."},Ld=e=>{let t=d(e);if(!t.isTestFile)return;let r=[],s=new WeakSet;e.on("CallExpression",o=>{let i=b(o,t);if((i?.kind==="test"||i?.kind==="suite")&&r.length>0)return{node:o,messageId:ti};if(P(o,t,e)!=="test")return;let a=v(o,t);a&&(r.push(a),s.add(o))}),e.onExit("CallExpression",o=>{s.delete(o)&&r.pop()});let n=new WeakSet;e.on(j,o=>{let i=D(o,e,t);P(i,t,e)==="test"&&(n.add(o),r.push(o))}),e.onExit(j,o=>{n.delete(o)&&r.pop()})},Gd={create:Ld,meta:{type:"problem",docs:{description:"Disallow tests and suites nested inside a test body.",recommended:"unopinionated"},schema:[],messages:Fd,languages:["js/js"]}},ri=Gd;function Fe({modifier:e,description:t,errorMessage:r,recommended:s}){let n=`no-${e}-test/error`,o=`no-${e}-test/suggestion`,i={[n]:r,[o]:`Remove \`.${e}\`.`};return{create:c=>{let{sourceCode:l}=c,u=d(c);if(!u.isTestFile)return;let p=y(u,{trackHooks:!0});c.on("CallExpression",f=>{let g=p.isSubtestCall(f);p.update(f);let h=b(f,u);if(!h&&!g||h?.kind==="hook")return;let k=h&&ps(h.modifiers,e);if(k){let x=k.parent,A=l.getTokenBefore(k),H=l.getTokenAfter(A,{includeComments:!0}),z=l.getRange(k),Ee=x?.type==="MemberExpression"&&!h.hasStandaloneModifier&&!x.computed&&x.property===k&&x===S(f.callee)&&A.value==="."&&l.getRange(H)[0]===z[0]?[{messageId:o,fix(Je){return Je.removeRange([l.getRange(A)[0],l.getRange(k)[1]])}}]:void 0;return{node:k,messageId:n,suggest:Ee}}let T=st(F(f),e,c);if(T)return{node:T,messageId:n}}),c.onExit("CallExpression",f=>{p.leave(f)})},meta:{type:"problem",docs:{description:t,recommended:s},hasSuggestions:!0,schema:[],messages:i,languages:["js/js"]}}}var Bd=Fe({modifier:"only",description:"Disallow the `.only` test modifier.",errorMessage:"Do not use the `.only` test modifier: it can stop the other tests from running.",recommended:"unopinionated"}),si=Bd;var oi="no-parent-test-context/error",ii="no-parent-test-context/suggestion",Hd={[oi]:"Do not use the parent test context `{{parent}}` inside this subtest. Use this subtest's own context instead.",[ii]:"Replace `{{parent}}` with `{{child}}`."};function ai(e,t,r){let[s,n]=r.getRange(e),[o,i]=r.getRange(t);return s>=o&&n<=i}function qd(e,t){let r=$t(e);if(!r)return;let s=C(t.getScope(r),r);return tt(s)?s:void 0}function ci(e,t){return t.getScope(e).references.find(r=>r.identifier===e)?.resolved}function Ud(e,t,r){for(let s=r-1;s>=0;s-=1){let n=e[s];if(n.contextVariable===t)return n}}function Vd(e,t,r){let s=K(e);if(!s)return;let n=ci(s,r);if(n)return t.findLast(o=>o.contextVariable===n)}function Wd(e){return e.parent.type==="Property"&&e.parent.shorthand}function $d(e){let t=e.parent;for(;t?.type==="MemberExpression";)t=t.parent;return t?.type==="CallExpression"&&K(t)===e}function Kd(e,t,r){return!t.contextParameter||!ai(e,t.callback.body,r)||Wd(e)?!1:C(r.getScope(e),t.contextParameter.name)===t.contextVariable}function zd(e,t,r){for(let s=t.length-1;s>=0;s-=1)if(ai(e,t[s].callback,r))return s}function ni(e,t,r){let s=zd(e,t,r);if(s===void 0)return;let n=t[s];if(!n.isSubtest)return;let o=ci(e,r);if(!o)return;let i=Ud(t,o,s);if(!i)return;let a={parent:i.contextParameter.name,child:n.contextParameter?.name},c={node:e,messageId:oi,data:a};return Kd(e,n,r)&&(c.suggest=[{messageId:ii,data:a,fix:l=>l.replaceText(e,n.contextParameter.name)}]),c}var Xd=e=>{let{sourceCode:t}=e,r=d(e);if(!r.isTestFile)return;let s=[];e.on("CallExpression",n=>{let o=K(n),i=o&&ni(o,s,t),a=Vd(n,s,t)!==void 0||o===void 0&&qe(n,r);if(!(b(n,r)?.kind==="test")&&!a)return i;let u=v(n);if(!u)return i;let p=q(u.params),f=qd(p,t);return s.push({node:n,callback:u,contextParameter:p,contextVariable:f,isSubtest:a}),i}),e.on("Identifier",n=>{if(!$d(n))return ni(n,s,t)}),e.onExit("CallExpression",n=>{s.at(-1)?.node===n&&s.pop()})},Yd={create:Xd,meta:{type:"problem",docs:{description:"Disallow references to parent test contexts inside subtests.",recommended:"unopinionated"},hasSuggestions:!0,schema:[],messages:Hd,languages:["js/js"]}},li=Yd;var ui="no-process-chdir-in-test",Jd={[ui]:"Do not call `process.chdir()` inside a test. Use absolute paths instead."},Qd=new Set(["node:process","process"]),pi=e=>e.importKind===void 0||e.importKind==="value",Zd=(e,t,r,s)=>{if(!pi(e))return;let[n]=t.getDeclaredVariables(e);if(!n)return;if(e.type==="ImportDefaultSpecifier"||e.type==="ImportNamespaceSpecifier"){r.add(n);return}let o=X(e);o==="default"?r.add(n):o==="chdir"&&s.add(n)},eg=e=>{let t=new Set,r=new Set;for(let s of e.ast.body)if(s.type==="ImportDeclaration"&&Qd.has(s.source.value)&&pi(s))for(let n of s.specifiers)Zd(n,e,t,r);return{processBindings:t,chdirBindings:r}},tg=e=>{let t=d(e);if(!t.isTestFile)return;let{sourceCode:r}=e,{processBindings:s,chdirBindings:n}=eg(r),o=y(t),i=l=>{l=S(l);let u=De(l);if(u)return Q(e,u,u.name);if(l?.type!=="Identifier")return!1;let p=C(r.getScope(l),l);return s.has(p)||l.name==="process"&&(!p||p.defs.length===0)},a=l=>{let u=S(l.callee);if(u?.type==="Identifier")return n.has(C(r.getScope(u),u))?u:void 0;if(u?.type==="MemberExpression"&&!u.computed&&u.property.type==="Identifier"&&u.property.name==="chdir"&&i(u.object))return u},c=l=>P(D(l,e,t),t,e)==="test";e.on("CallExpression",l=>{let u=O(l),p=a(l);if(o.update(l),p&&(o.isTrackedCallback(u)||c(u)))return{node:p,messageId:ui}}),e.onExit("CallExpression",l=>{o.leave(l)})},rg={create:tg,meta:{type:"problem",docs:{description:"Disallow changing the working directory inside tests.",recommended:!0},schema:[],messages:Jd,languages:["js/js"]}},fi=rg;var Le="no-process-env-mutation",sg={[Le]:"Do not mutate `process.env` inside a test. Use a hook that restores the original value."},ng=new Set(["node:process","process"]),og=new Set(["assign","defineProperties","defineProperty"]),ig=new Set(["deleteProperty","defineProperty","set"]),ag=e=>e.type==="Identifier"?e.name:di(e),di=e=>{if(e.type==="Literal"&&(typeof e.value=="string"||typeof e.value=="number"))return String(e.value);if(e.type==="TemplateLiteral"&&e.expressions.length===0)return e.quasis[0].value.cooked},mi=e=>{if(e.type==="MemberExpression"){if(!e.computed&&e.property.type==="Identifier")return e.property.name;if(e.computed)return di(S(e.property))}},vt=(e,t,r)=>t.type!=="Identifier"||!r.has(t.name)?!1:C(e.sourceCode.getScope(t),t)?.defs.some(n=>n.type==="ImportBinding")??!1,gi=e=>{if(e=S(e),e?.type==="Identifier")return e;if(e?.type==="MemberExpression")return gi(e.object)},cg=e=>{let t=new Set,r=new Set;for(let s of e.sourceCode.ast.body)if(!(s.type!=="ImportDeclaration"||!ng.has(s.source.value))){for(let n of s.specifiers)if(n.type==="ImportDefaultSpecifier"||n.type==="ImportNamespaceSpecifier")t.add(n.local.name);else if(n.type==="ImportSpecifier"){let o=X(n);o==="default"?t.add(n.local.name):o==="env"&&r.add(n.local.name)}}return{processNames:t,environmentNames:r}},lg=e=>{let t=d(e);if(!t.isTestFile)return;let{processNames:r,environmentNames:s}=cg(e),{sourceCode:n}=e,o=[],i=new Set,a=E=>{E=S(E);let w=De(E);return w?Q(e,w,w.name):E?.type==="Identifier"&&(vt(e,E,r)||E.name==="process"&&Q(e,E,"process"))},c=(E,w)=>{if(E.type!=="Property"||E.computed||ag(E.key)!=="env")return!1;let{value:L}=E;return L.type==="Identifier"?L.name===w:L.type==="AssignmentPattern"&&L.left.type==="Identifier"&&L.left.name===w},l=(E,w)=>{if(E.type!=="Identifier")return!1;let L=C(n.getScope(E),E);if(!L||w.has(L))return!1;w.add(L);let Se=L.defs.length===1?L.defs[0]:void 0,ve=Se?.type==="Variable"?Se.node:void 0;return!ve?.init||ve.parent?.kind!=="const"?!1:ve.id.type==="Identifier"?u(ve.init,w):ve.id.type==="ObjectPattern"&&a(ve.init)&&ve.id.properties.some(Bc=>c(Bc,E.name))},u=(E,w=new Set)=>(E=S(E),E?E.type==="Identifier"?vt(e,E,s)||l(E,w):E.type==="LogicalExpression"&&(E.operator==="??"||E.operator==="||")?u(E.left,w):E.type==="MemberExpression"&&mi(E)==="env"&&a(E.object):!1),p=E=>(E=S(E),E?.type==="MemberExpression"&&u(E.object)),f=E=>{if(E=S(E),!!E){if(E.type==="MemberExpression"&&(u(E)||p(E)))return E;if(E.type==="AssignmentPattern")return f(E.left);if(E.type==="RestElement")return f(E.argument);if(E.type==="ArrayPattern"){for(let w of E.elements){let L=f(w);if(L)return L}return}if(E.type==="ObjectPattern")for(let w of E.properties){let L=f(w.type==="Property"?w.value:w.argument);if(L)return L}}},g=E=>{let w=q(E.params);if(w)return C(n.getScope(w),w)},h=E=>{let w=b(E,t);if(w?.kind!=="test"||w.modifiers.some(Se=>!_.has(Se.name)))return!1;let L=gi(E.callee);return L?.type==="Identifier"&&(vt(e,L,t.locals)||t.namespaces.has(L.name)&&vt(e,L,t.namespaces))},k=E=>b(E,t)===void 0&&P(E,t,e)==="test",T=E=>{if(!h(E)&&!k(E))return;let w=v(E);w&&(o.push({callback:w,contextVariable:g(w)}),i.add(E))},x=E=>{i.has(E)&&(i.delete(E),o.pop())},A=new WeakSet,H=E=>{let w=D(E,e,t);if(!w)return;let L=b(w,t);P(w,t,e)!=="test"||L?.modifiers.some(Se=>!_.has(Se.name))||(A.add(E),o.push({callback:E,contextVariable:g(E)}))},z=E=>{A.delete(E)&&o.pop()},Ee=E=>{let w=O(E);return w!==void 0&&o.some(L=>L.callback===w)},Je=E=>{if(Ee(E)){if(E.type==="AssignmentExpression")return f(E.left);if(E.type==="UpdateExpression")return p(E.argument)?S(E.argument):void 0;if(E.type==="UnaryExpression"&&E.operator==="delete"&&(u(E.argument)||p(E.argument)))return S(E.argument)}},Gc=E=>{if(!Ee(E))return;let w=S(E.callee);if(w?.type!=="MemberExpression"||E.arguments.length===0||!u(E.arguments[0]))return;let L=mi(w),Se=S(w.object);if(L&&(og.has(L)&&Q(e,Se,"Object")||ig.has(L)&&Q(e,Se,"Reflect")))return S(E.arguments[0])},Wr=E=>{if(Ee(E))return f(E.left)};e.on("CallExpression",E=>{T(E);let w=Gc(E);if(w)return{node:w,messageId:Le}}),e.onExit("CallExpression",E=>{x(E)}),e.on(j,H),e.onExit(j,z),e.on("AssignmentExpression",E=>{let w=Je(E);if(w)return{node:w,messageId:Le}}),e.on("UpdateExpression",E=>{let w=Je(E);if(w)return{node:w,messageId:Le}}),e.on("UnaryExpression",E=>{let w=Je(E);if(w)return{node:w,messageId:Le}}),e.on("ForInStatement",E=>{let w=Wr(E);if(w)return{node:w,messageId:Le}}),e.on("ForOfStatement",E=>{let w=Wr(E);if(w)return{node:w,messageId:Le}})},ug={create:lg,meta:{type:"problem",docs:{description:"Disallow mutating `process.env` inside tests.",recommended:!0},schema:[],messages:sg,languages:["js/js"]}},yi=ug;var hi="processExit",yr="processExitCode",pg={[hi]:"Do not call `process.exit()` in a test file. Throw an error or use an assertion instead.",[yr]:"Do not set `process.exitCode` in a test file. Throw an error or use an assertion instead."},fg=new Set(["node:process","process"]),mg=e=>{let t=new Set;for(let r of e.ast.body)if(!(r.type!=="ImportDeclaration"||r.importKind==="type"||!fg.has(r.source.value)))for(let s of r.specifiers)s.type==="ImportSpecifier"&&s.importKind!=="type"&&X(s)==="exit"&&t.add(...e.getDeclaredVariables(s));return t},gr=(e,t,r)=>{let s=S(t);if(s?.type!=="MemberExpression"||s.computed||s.property.type!=="Identifier"||s.property.name!==r)return;let n=S(s.object);if(n?.type==="Identifier"&&n.name==="process")return s;let o=De(n);return o&&Q(e,o,o.name)?s:void 0},dg=(e,t,r)=>{let s=S(e);return s?.type==="Identifier"&&t.has(C(r.getScope(s),s))?s:void 0},gg=e=>{if(!d(e).isTestFile)return;let r=mg(e.sourceCode);e.on("CallExpression",s=>{let n=dg(s.callee,r,e.sourceCode);if(!(!gr(e,s.callee,"exit")&&!n))return{node:n??s,messageId:hi}}),e.on("AssignmentExpression",s=>{let n=gr(e,s.left,"exitCode");if(n)return{node:n,messageId:yr}}),e.on("UpdateExpression",s=>{let n=gr(e,s.argument,"exitCode");if(n)return{node:n,messageId:yr}})},yg={create:gg,meta:{type:"problem",docs:{description:"Disallow process exit control in test files.",recommended:"unopinionated"},schema:[],messages:pg,languages:["js/js"]}},Ei=yg;var hg=Fe({modifier:"skip",description:"Disallow the `.skip` test modifier.",errorMessage:"Do not skip tests.",recommended:!0}),Si=hg;var xi="no-skip-without-reason/option",hr="no-skip-without-reason/call",Eg={[xi]:"Give `{{modifier}}` a reason string instead of `true` explaining why.",[hr]:"Pass a reason message to `{{context}}.{{modifier}}()`."},bi=new Set(["skip","todo"]),Sg=e=>{let t=d(e);if(!t.isTestFile)return;let r=y(t,{trackHooks:!0});e.on("CallExpression",s=>{let n=[],o=b(s,t);if(o&&o.kind!=="hook"||r.isSubtestCall(s)){let a=F(s);for(let c of bi){let l=W(a,c),u=l&&m(l.value);u?.type==="Literal"&&u.value===!0&&n.push({node:l,messageId:xi,data:{modifier:c}})}}let i=m(s.callee);if(s.arguments.length===0&&i.type==="MemberExpression"&&!i.computed&&i.property.type==="Identifier"&&bi.has(i.property.name)){let a=m(i.object);a.type==="Identifier"&&r.isContextIdentifier(a)?n.push({node:s,messageId:hr,data:{context:a.name,modifier:i.property.name}}):M(a,t)&&n.push({node:s,messageId:hr,data:{context:e.sourceCode.getText(a),modifier:i.property.name}})}return r.update(s),n}),e.onExit("CallExpression",s=>{r.leave(s)})},bg={create:Sg,meta:{type:"suggestion",docs:{description:"Require a reason when skipping or marking a test as todo.",recommended:!1},schema:[],messages:Eg,languages:["js/js"]}},ki=bg;var Ci="no-skip-without-return/error",Ti="no-skip-without-return/suggestion",xg={[Ci]:"`{{name}}.{{method}}()` does not stop the test; code after it still runs. Return afterwards.",[Ti]:"Add `return` after `{{name}}.{{method}}()`."},kg=new Set(["skip","todo"]);function Ii(e){let{parent:t}=e;if(!["BlockStatement","Program","StaticBlock","SwitchCase"].includes(t?.type))return;let r=t.type==="SwitchCase"?t.consequent:t.body;return r[r.indexOf(e)+1]}function Cg(e,t){let r=oe(e.parent);return r.type==="UnaryExpression"&&r.operator==="void"?oe(r.parent)===t:r===t}function Tg(e){for(let t=e.parent;t&&!I(t);t=t.parent)if(e.label?t.type==="LabeledStatement"&&t.label.name===e.label.name:Ie(t)||t.type==="SwitchStatement")return t}function Ig(e){let t=e;for(;t;){let{parent:r}=t;if(!r)return!1;let s=Ii(t);if(s){if(s.type==="ReturnStatement"||s.type==="ThrowStatement")return!1;if(s.type==="BreakStatement"){t=Tg(s)??r;continue}if(s.type==="ContinueStatement"){t=r;continue}return!0}if(I(r))return!1;t=r}return!1}var vg=e=>{let{sourceCode:t}=e,r=d(e);if(!r.isTestFile)return;let s=y(r,{trackHooks:!0}),n=o=>o.type==="Identifier"?s.isContextIdentifier(o)?o.name:void 0:M(o,r)?t.getText(o):void 0;e.on("CallExpression",o=>{let i,a=m(o.callee),c=Y(o)?.statement,l=a.type==="MemberExpression"?n(m(a.object)):void 0;if(c?.type==="ExpressionStatement"&&a.type==="MemberExpression"&&!a.computed&&a.property.type==="Identifier"&&kg.has(a.property.name)&&l&&Ig(c)){let u=a.property.name;i={node:o,messageId:Ci,data:{name:l,method:u}};let p=Ii(c),f=p?.type==="BreakStatement"||p?.type==="ContinueStatement";Cg(o,c)&&!f&&c.parent.type==="BlockStatement"&&!ae(c,O(c))&&(i.suggest=[{messageId:Ti,data:{name:l,method:u},fix(g){let[h]=t.getRange(c),k=t.text.lastIndexOf(`
7
+ `,h-1)+1,[T]=/^\s*/.exec(t.text.slice(k,h)),[x]=t.getCommentsAfter(c),H=x&&t.getLoc(x).start.line===t.getLoc(c).end.line?x:c;return g.insertTextAfter(H,`
8
+ ${T}return;`)}}])}return s.update(o),i}),e.onExit("CallExpression",o=>{s.leave(o)})},wg={create:vg,meta:{type:"problem",docs:{description:"Disallow `t.skip()`/`t.todo()` without returning afterwards.",recommended:!0},hasSuggestions:!0,schema:[],messages:xg,languages:["js/js"]}},vi=wg;var Er="no-sleep-in-test",Ag={[Er]:"Do not sleep in tests with `setTimeout`. Await the real signal or use mock timers instead."},Rg=new Set(["node:timers","timers"]),Og=new Set(["node:timers/promises","timers/promises"]),jg=new Set(["only","todo"]);function Sr(e,t){return e?.type==="Identifier"&&e.name===t}function wt(e,t,r){if(t=S(t),!Sr(t,r))return!1;let s=C(e.getScope(t),t);return!s||s.defs.length===0}function Ai(e,t,r){return t=S(t),t?.type==="Identifier"&&C(e.getScope(t),t)===r}function Pg(e,t){return t=S(t),t?.type==="MemberExpression"&&!t.computed&&(wt(e,t.object,"globalThis")||wt(e,t.object,"global"))&&Sr(t.property,"setTimeout")}function wi(e){return e.every(t=>jg.has(t.name))}function Ri(e,t){return Ne(F(e),t)}function Mg(e){let{members:t=[]}=ee(e.callee)??{};return t?.[0]?.name==="test"?t.slice(1):[]}function Dg(e,t,r){return t.kind!=="hook"&&Ri(e,r)}function _g(e){let t=new Set,r=new Set,s=new Set,n=new Set;for(let o of e.ast.body){if(o.type!=="ImportDeclaration")continue;let i=Rg.has(o.source.value),a=Og.has(o.source.value);if(!(!i&&!a))for(let c of o.specifiers){if(c.type==="ImportSpecifier"&&X(c)==="setTimeout"){let l=C(e.getScope(c.local),c.local);l&&(a?s:t).add(l)}if(c.type==="ImportNamespaceSpecifier"||c.type==="ImportDefaultSpecifier"){let l=C(e.getScope(c.local),c.local);l&&(a?n:r).add(l)}}}return{named:t,namespace:r,promiseNamed:s,promiseNamespace:n,sourceCode:e}}function Oi(e,t,r,s){return e=S(e),e?.type==="Identifier"?r.has(C(t.getScope(e),e)):e?.type==="MemberExpression"&&!e.computed&&S(e.object)?.type==="Identifier"&&s.has(C(t.getScope(e.object),S(e.object)))&&Sr(e.property,"setTimeout")}function Ng(e,t){return Oi(e,t.sourceCode,t.named,t.namespace)}function Fg(e,t){return Oi(e,t.sourceCode,t.promiseNamed,t.promiseNamespace)}function Lg(e,t){return e=S(e),wt(t.sourceCode,e,"setTimeout")||Pg(t.sourceCode,e)||Ng(e,t)}function ji(e,t,r){let s=[e];for(;s.length>0;){let n=S(s.pop());if(n?.type){if(t(n))return!0;if(!I(n))for(let o of r[n.type]??[]){let i=n[o];for(let a of Array.isArray(i)?i:[i])a?.type&&s.push(a)}}}return!1}function Gg(e,t,r){return e=S(e),e?.type==="CallExpression"&&Ai(r,e.callee,t)}function Bg(e,t,r){return e=S(e),I(e)?ji(e.body,s=>Gg(s,t,r),r.visitorKeys):!1}function Hg(e,t,r){return e=S(e),Ai(r,e,t)||Bg(e,t,r)}function qg(e,t,r){return e=S(e),e?.type==="CallExpression"&&Lg(e.callee,r)&&Hg(e.arguments[0],t,r.sourceCode)}function Ug(e,t){if(e=S(e),e?.type!=="NewExpression"||!wt(t.sourceCode,e.callee,"Promise"))return!1;let[r]=e.arguments,s=S(r),n=I(s)?s.params.slice(0,2).filter(i=>i.type==="Identifier").map(i=>C(t.sourceCode.getScope(i),i)).filter(Boolean):[];if(n.length===0)return!1;let o=i=>n.some(a=>qg(i,a,t));return ji(s.body,o,t.sourceCode.visitorKeys)}function Vg(e,t){return e=S(e),e?.type==="CallExpression"&&Fg(e.callee,t)}var Wg=e=>{let t=d(e);if(!t.isTestFile)return;let r=_g(e.sourceCode),s=i=>{let a=b(i,t);return a?wi(a.modifiers)&&!Dg(i,a,e):xe(i)!==void 0||wi(Mg(i))&&!Ri(i,e)},n=i=>{let a=new Set;for(let c=i.parent;c;c=c.parent){if(!I(c)||a.has(c))continue;a.add(c);let l=Oe(c),u=l&&v(l,t)===c?l:void 0,p=u??D(c,e,t);if(p&&P(p,t,e)!==void 0&&!s(p))return!0;p&&!u&&(c=p)}return!1},o=i=>{let a=Te(i,t,e);return(a==="test"||a==="hook")&&!n(i)};e.on("NewExpression",i=>{if(!(!Ug(i,r)||!o(i)))return{node:i,messageId:Er}}),e.on("CallExpression",i=>{if(!(!Vg(i,r)||!o(i)))return{node:i,messageId:Er}})},$g={create:Wg,meta:{type:"problem",docs:{description:"Disallow sleeping in tests with `setTimeout`.",recommended:!1},schema:[],messages:Ag,languages:["js/js"]}},Pi=$g;var Di="no-snapshot-in-loop",Kg={[Di]:"Do not use positional snapshots inside loops. Changing the iteration count shifts every following snapshot."};function zg(e,t,r){let s=q(t.params);return!s||e.name!==s.name?!1:C(r.getScope(e),e)?.defs.some(o=>o.name===s)??!1}function Xg(e,t){let r=S(e.callee);if(r?.type!=="MemberExpression"||r.computed||r.property.type!=="Identifier"||r.property.name!=="snapshot")return!1;let s=S(r.object);return s?.type==="MemberExpression"&&!s.computed&&s.property.type==="Identifier"&&s.property.name==="assert"&&M(S(s.object),t)}function Mi(e,t,r,s){let n=O(e);if(n&&(n===t.currentCallback()||P(D(n,r,s),s,r)==="test"))return n}function Yg(e,t,r,s){if(Xg(e,s))return Mi(e,t,r,s)!==void 0;let n=ee(e.callee);if(n?.members.length!==2||n.members[0].name!=="assert"||n.members[1].name!=="snapshot")return!1;let o=Mi(e,t,r,s);return o!==void 0&&zg(n.root,o,r.sourceCode)}function Jg(e){let t=e,r=e.parent;for(;r;){if(I(r))return!1;if(Ie(r)&&r.body===t)return!0;t=r,r=r.parent}return!1}var Qg=e=>{let t=d(e);if(!t.isTestFile)return;let r=y(t);e.on("CallExpression",s=>{let n;return Yg(s,r,e,t)&&Jg(s)&&(n={node:s,messageId:Di}),r.update(s),n}),e.onExit("CallExpression",s=>{r.leave(s)})},Zg={create:Qg,meta:{type:"problem",docs:{description:"Disallow snapshot assertions inside loop bodies.",recommended:!1},schema:[],messages:Kg,languages:["js/js"]}},_i=Zg;var Ni="no-standalone-assert",ey={[Ni]:"Assertion runs when the module is loaded, not as part of a test. Move it into a test or hook."},ty=e=>{let t=d(e);!t.isTestFile||!t.hasAssert||e.on("CallExpression",r=>{let s=te(r,t);if(!(!s||s.contextReceiver)){for(let n=r,o=r.parent;o;n=o,o=o.parent)if(I(o)||(o.type==="PropertyDefinition"||o.type==="AccessorProperty")&&!o.static&&!(o.computed&&o.key===n))return;return{node:r,messageId:Ni}}})},ry={create:ty,meta:{type:"problem",docs:{description:"Disallow assertions outside of a test.",recommended:"unopinionated"},schema:[],messages:ey,languages:["js/js"]}},Fi=ry;var Hi="no-test-global-configuration",sy={[Hi]:"Do not configure `node:test` inside a test. This changes process-wide state."},ny=new Map([["assert",new Set(["register"])],["snapshot",new Set(["setDefaultSnapshotSerializers","setResolveSnapshotPath"])]]);function qi(e,t){return C(t.getScope(e),e)?.defs.some(s=>s.type==="ImportBinding")??!1}function Li(e,t,r){return qi(e,r)?t.namespaces.has(e.name)||le.has(t.locals.get(e.name)):!1}function Gi(e,t){return ny.get(e)?.has(t)??!1}function oy(e,t,r){let s=ee(e.callee);if(!s)return!1;let{root:n}=s,o=s.members[0],{members:i}=s;(t.namespaces.has(n.name)&&!t.locals.has(n.name)&&o?.name==="default"||Li(n,t,r)&&le.has(o?.name))&&(i=s.members.slice(1));let a=t.configurationLocals.get(n.name);return a&&i.length===1&&qi(n,r)?Gi(a,i[0].name):i.length===2&&Li(n,t,r)&&Gi(i[0].name,i[1].name)}function iy(e){return e?.kind==="test"&&e.modifiers.every(t=>_.has(t.name))}function ay(e){return e?.kind==="suite"&&e.modifiers.every(t=>_.has(t.name))}function cy(e){return e?.kind==="hook"&&e.modifiers.length===0}function Bi(e,t,r){let s=e.parent;for(;s;){if(t.has(s))return!0;if(r?.has(s))return!1;s=s.parent}return!1}var ly=e=>{let t=d(e);if(!t.isTestFile)return;let{sourceCode:r}=e,s=new Set,n=new Set,o=new Set,i=y(t);e.on("CallExpression",a=>{let c=b(a,t);if(ay(c)){let l=v(a);l&&n.add(l)}if(iy(c)||i.isSubtestCall(a)){o.add(a);let l=v(a);l&&s.add(l)}else if(cy(c)&&Bi(a,n)){let l=V(a);l&&s.add(l)}if(i.update(a),Bi(a,s,o)&&oy(a,t,r))return{node:a,messageId:Hi}}),e.onExit("CallExpression",a=>{i.leave(a)})},uy={create:ly,meta:{type:"problem",docs:{description:"Disallow process-wide `node:test` configuration inside tests.",recommended:!0},schema:[],messages:sy,languages:["js/js"]}},Ui=uy;var Vi="no-test-inside-hook",py={[Vi]:"Do not define a test or suite inside a hook. Define it at the top level or inside a `describe`."},fy=e=>{let t=d(e);if(!t.isTestFile)return;let r=[],s=new WeakSet,n=y(t,{trackHooks:!0});e.on("CallExpression",i=>{let a=N(i,n.isContextReceiver),c=n.isSubtestCall(i);n.update(i);let l=b(i,t);if(!l&&!a&&!c)return;let u=a?"hook":l?l.kind:"test",p=r.at(-1)!==void 0;if(u==="hook"){let f=V(i);f&&(r.push(f),s.add(i))}else u==="test"&&p&&v(i,t)&&(r.push(void 0),s.add(i));if((u==="test"||u==="suite")&&p)return{node:i,messageId:Vi}}),e.onExit("CallExpression",i=>{n.leave(i),s.delete(i)&&r.pop()});let o=new WeakSet;e.on(j,i=>{let a=D(i,e,t),c=P(a,t,e);c!=="hook"&&c!=="test"||(o.add(i),r.push(c==="hook"?i:void 0))}),e.onExit(j,i=>{o.delete(i)&&r.pop()})},my={create:fy,meta:{type:"problem",docs:{description:"Disallow defining tests and suites inside a hook.",recommended:"unopinionated"},schema:[],messages:py,languages:["js/js"]}},Wi=my;var br="no-test-return-statement",dy={[br]:"Do not return a concrete value from a test or hook. Return a Promise to signal async completion, or return nothing."},gy=new Set(["void","undefined","null","any","never","unknown"]);function Ki(e,t){return e.isUnion()?e.types.every(r=>Ki(r,t)):it(e,t)!==!1?!0:gy.has(t.typeToString(e))}function $i(e,t,r){let s;try{s=t.getTypeAtLocation(e)}catch{return!1}return!Ki(s,r)}function yy(e,t,r){let s=b(e,t);if(s?.kind==="test")return s.modifiers.some(n=>!_.has(n.name))?void 0:v(e);if(s?.kind==="hook"&&s.modifiers.length===0)return V(e);if(r.isSubtestCall(e))return v(e);if(N(e,r.isContextReceiver))return V(e)}var hy=e=>{let t=d(e);if(!t.isTestFile)return;let{parserServices:r}=e.sourceCode;if(!r?.program)return;let s=r.program.getTypeChecker(),n=y(t,{trackHooks:!0});e.on("CallExpression",o=>{let i=yy(o,t,n);if(n.update(o),i?.type==="ArrowFunctionExpression"&&i.body.type!=="BlockStatement"&&!i.async&&$i(i.body,r,s))return{node:i.body,messageId:br}}),e.onExit("CallExpression",o=>{n.leave(o)}),e.on("ReturnStatement",o=>{if(!o.argument)return;let i=O(o);if(!(!i||!n.isTrackedCallback(i))&&!i.async&&$i(o.argument,r,s))return{node:o,messageId:br}})},Ey={create:hy,meta:{type:"suggestion",docs:{description:"Disallow returning a concrete non-Promise value from a test or hook.",recommended:!0},schema:[],messages:dy,languages:["js/js"]}},zi=Ey;var Sy=Fe({modifier:"todo",description:"Disallow the `.todo` test modifier.",errorMessage:"Do not commit `.todo` tests.",recommended:!1}),Xi=Sy;var xr="no-unawaited-rejects/error",by={[xr]:"`assert.{{method}}()` must be awaited or returned."},xy=new Set(["rejects","doesNotReject"]),ky=e=>{let t=d(e);if(!t.isAssertOrTestFile)return;let r=y(t,{trackHooks:!0});e.on("CallExpression",s=>{r.update(s);let n=R(s,t,r);if(!n||!xy.has(n.method))return;let o=Y(s);if(!o)return;let i=O(s);return i?.async===!0&&o.canAwait&&!ae(s,i)?{node:s,messageId:xr,data:{method:n.method},fix:a=>a.insertTextBefore(s,"await ")}:{node:s,messageId:xr,data:{method:n.method}}}),e.onExit("CallExpression",s=>{r.leave(s)})},Cy={create:ky,meta:{type:"problem",docs:{description:"Require `assert.rejects()`/`assert.doesNotReject()` to be awaited or returned.",recommended:"unopinionated"},fixable:"code",schema:[],messages:by,languages:["js/js"]}},Yi=Cy;var Ji="no-unawaited-subtest",Ty={[Ji]:"Subtest `{{name}}.test()` must be awaited or returned, so the test's own work does not run alongside it."},Iy=e=>{let t=d(e);if(!t.isTestFile)return;let r=y(t,{trackHooks:!0}),s=Fo(e),n=o=>r.currentCallback()!==void 0&&C(e.sourceCode.getScope(o),o.name)!==r.currentContextVariable();e.on("CallExpression",o=>{let i=r.isSubtestCall(o),a=Y(o),c;if(i&&a&&!s(o)){let l=K(o),u=l?l.name:e.sourceCode.getText(S(S(o.callee).object));c={node:o,messageId:Ji,data:{name:u}};let p=O(o);p?.async&&a.canAwait&&!ae(o,p)&&!(l&&n(l))&&(c.fix=f=>f.insertTextBefore(o,"await "))}return r.update(o),c}),e.onExit("CallExpression",o=>{r.leave(o)})},vy={create:Iy,meta:{type:"problem",docs:{description:"Require subtests created with the test context to be awaited or returned.",recommended:!0},fixable:"code",schema:[],messages:Ty,languages:["js/js"]}},Qi=vy;var Zi="no-unknown-test-options",wy={[Zi]:"`{{name}}` is not a recognized {{kind}} option."},Ay=new Set(["concurrency","expectFailure","fn","name","only","plan","signal","skip","tags","timeout","todo"]),Ry=new Set(["signal","timeout"]),Oy=e=>{let t=d(e);if(!t.isTestFile)return;let r=y(t,{trackHooks:!0});e.on("CallExpression",function*(s){let n=r.isSubtestCall(s),o=N(s,r.isContextReceiver);r.update(s);let i=b(s,t);if(!i&&!n&&!o)return;let a=F(s);if(!a)return;let c=i?.kind==="hook"||o,l=c?Ry:Ay;for(let u of a.properties){if(u.type!=="Property")continue;let p=$(u);p===void 0||u.key.type==="Literal"&&typeof u.key.value!="string"||l.has(p)||(yield{node:u.key,messageId:Zi,data:{name:p,kind:c?"hook":"test"}})}}),e.onExit("CallExpression",s=>{r.leave(s)})},jy={create:Oy,meta:{type:"problem",docs:{description:"Disallow unknown options in test and hook option objects.",recommended:!0},schema:[],messages:wy,languages:["js/js"]}},ea=jy;var sa="no-unneeded-async-rejects-callback/error",na="no-unneeded-async-rejects-callback/suggestion",Py={[sa]:"This `rejects()` callback may unnecessarily wrap a single awaited operation.",[na]:"Replace it with a plain Promise-returning callback."};function My(e){let t=e.body,r=!1;if(t.type==="BlockStatement"){if(t.body.length!==1)return;let[n]=t.body;if(n.type==="ExpressionStatement")t=n.expression,r=!0;else if(n.type==="ReturnStatement"&&n.argument)t=n.argument;else return}let s=m(t);if(s.type==="AwaitExpression")return{expression:t,awaitExpression:s,shouldAddReturn:r}}function ta(e,t,r){return e.getCommentsInside(t).some(s=>{let n=e.getRange(s);return n[0]>=r[0]&&n[1]<=r[1]})}function kr(e,t,r=new Set){if(r.has(e))return!1;if(r.add(e),e.isUnion())return e.types.every(n=>kr(n,t,new Set(r)));if(e.isIntersection()&&e.types.some(n=>kr(n,t,new Set(r))))return!0;let s=e.getSymbol();return s?.getName()==="Promise"&&s.declarations?.some(n=>t.isSourceFileDefaultLibrary(n.getSourceFile()))===!0}function Dy(e,t,r){try{return kr(t.getTypeAtLocation(e),r)}catch{return!1}}function ra(e){return I(e)&&e.async&&!e.generator}function _y(e,t){if(e=m(e),e.type!=="CallExpression"||e.optional||e.arguments.length>0)return!1;let r=m(e.callee);if(ra(r))return!0;if(r.type!=="Identifier")return!1;let s=C(t.getScope(r),r);if(s?.defs.length!==1||s.references.some(o=>o.isWrite()&&!o.init))return!1;let[n]=s.defs;return n.type==="FunctionName"&&ra(n.node)}var Ny=e=>{let{sourceCode:t}=e,r=d(e);if(!r.isAssertOrTestFile)return;let{parserServices:s}=t,{program:n}=s??{},o=y(r,{trackHooks:!0});e.on("CallExpression",i=>{if(o.update(i),R(i,r,o)?.method!=="rejects")return;let[c]=i.arguments;if(!c||c.type==="SpreadElement")return;let l=m(c);if(!I(l)||!l.async||l.generator||l.typeParameters||l.params.length>0)return;let u=My(l);if(!(!u||ge(u.awaitExpression.argument,t.visitorKeys)||!_y(u.awaitExpression.argument,t)&&(!n||!Dy(u.awaitExpression.argument,s,n))))return{node:l,messageId:sa,suggest:[{messageId:na,*fix(p,{abort:f}){if(u.shouldAddReturn&&(re(u.awaitExpression,e)||t.getFirstToken(u.expression)!==t.getFirstToken(u.awaitExpression)))return f();let g=t.getFirstToken(l),h=t.getTokenAfter(g),k=[t.getRange(g)[0],t.getRange(h)[0]];if(ta(t,l,k))return f();yield p.removeRange(k);let T=t.getFirstToken(u.awaitExpression),x=t.getTokenAfter(T),A=[t.getRange(T)[0],t.getRange(x)[0]];if(ta(t,l,A))return f();u.shouldAddReturn?yield p.replaceTextRange(A,"return "):yield p.removeRange(A)}}]}}),e.onExit("CallExpression",i=>{o.leave(i)})},Fy={create:Ny,meta:{type:"suggestion",docs:{description:"Disallow unneeded async callbacks passed to `assert.rejects()`.",recommended:!1},hasSuggestions:!0,schema:[],messages:Py,languages:["js/js"]}},oa=Fy;var ia="no-useless-assertion",Ly={[ia]:"`{{method}}()` is not useful. It catches an error only to rethrow it, so call the code directly instead."},Gy=new Set(["doesNotThrow","doesNotReject"]),By=e=>{let t=d(e);if(!t.isAssertOrTestFile)return;let r=y(t,{trackHooks:!0});e.on("CallExpression",s=>{r.update(s);let n=R(s,t,r);if(!(!n||!Gy.has(n.method)))return{node:s,messageId:ia,data:{method:n.method}}}),e.onExit("CallExpression",s=>{r.leave(s)})},Hy={create:By,meta:{type:"suggestion",docs:{description:"Disallow `assert.doesNotThrow()` and `assert.doesNotReject()`.",recommended:!0},schema:[],messages:Ly,languages:["js/js"]}},aa=Hy;var ua="prefer-assert-match/error",qy={[ua]:"Prefer `assert.{{method}}()` over asserting `{{pattern}}` results."},Uy=new Set(["strictEqual","equal","notStrictEqual","notEqual"]);function ca(e){return e?ot(e)?!0:(e.type==="NewExpression"||e.type==="CallExpression")&&e.callee.type==="Identifier"&&e.callee.name==="RegExp":!1}function Vy(e){for(let{parent:t}=e;ne(t);t=t.parent)if(t.type==="ChainExpression")return!0;return!1}function Cr(e){if(e=S(e),e.type!=="CallExpression"||e.callee.type!=="MemberExpression"||e.callee.computed||e.callee.property.type!=="Identifier")return;let t=Vy(e),{name:r}=e.callee.property,{object:s}=e.callee;if(r==="test"&&ca(s)){let n=e.arguments[0];return!n||n.type==="SpreadElement"?void 0:{regex:s,string:n,methodName:"test",isOptional:t,argumentCount:e.arguments.length}}if(r==="match"&&e.arguments.length>0){let n=e.arguments[0];return!n||n.type==="SpreadElement"||!ca(n)?void 0:{regex:n,string:s,methodName:r,isOptional:t,argumentCount:e.arguments.length}}}function Wy({node:e,method:t,regexNode:r,stringNode:s,extraArgsToRemove:n,sourceCode:o}){return function*(a){let c=e.callee;if(c.type==="MemberExpression"&&!c.computed&&c.property.type==="Identifier")yield a.replaceText(c.property,t);else return;let l=o.getText(r),u=o.getText(s);yield a.replaceText(e.arguments[0],`${u}, ${l}`);for(let p of n){let f=o.getTokenBefore(p,{includeComments:!1});yield a.removeRange([o.getRange(f)[0],o.getRange(p)[1]])}}}function la(e){return e?.type==="SequenceExpression"}var $y=new Map([["Buffer",new Set(["from","alloc","concat"])],["JSON",new Set(["parse"])]]);function Ky(e){return e.type!=="MemberExpression"||e.computed||e.object.type!=="Identifier"?!1:$y.get(e.object.name)?.has(e.property.name)??!1}function pa(e){return e=m(e),e.type==="Literal"?typeof e.value!="string":e.type==="Identifier"?["NaN","Infinity","undefined"].includes(e.name):e.type==="UnaryExpression"?e.operator!=="typeof":e.type==="AssignmentExpression"?e.operator!=="="||pa(e.right):e.type==="ClassExpression"||e.type==="CallExpression"&&Ky(e.callee)?!0:e.type==="ArrayExpression"||e.type==="ObjectExpression"||e.type==="NewExpression"||I(e)}function zy(e,t,r){return e.callee.type==="MemberExpression"&&t.sourceCode.getCommentsInside(e).length===0&&e.arguments.every(s=>!re(s,t))&&!la(r.string)&&!la(r.regex)&&!r.isOptional&&r.argumentCount===1&&!pa(r.string)}function fa({node:e,assertMethod:t,regexCall:r,extraArgsToRemove:s,context:n}){let o=zy(e,n,r)?Wy({node:e,method:t,regexNode:r.regex,stringNode:r.string,extraArgsToRemove:s,sourceCode:n.sourceCode}):void 0;return{node:e,messageId:ua,data:{method:t,pattern:`${r.methodName}()`},fix:o}}function Xy(e,t,r){if(e.arguments.length<2)return;let[s,n]=e.arguments,o=m(s),i=m(n),a=Cr(o),c=i;if(!(a&&bt(c))&&(a=Cr(i),c=o,!(a&&bt(c)))||a.methodName!=="test")return;let l=t==="notStrictEqual"||t==="notEqual",p=c.value===!0!==l?"match":"doesNotMatch";return fa({node:e,assertMethod:p,regexCall:a,extraArgsToRemove:[n],context:r})}var Yy=e=>{let t=d(e);if(!t.isAssertOrTestFile)return;let r=y(t,{trackHooks:!0});e.on("CallExpression",s=>{r.update(s);let n=R(s,t,r);if(!n)return;let{method:o}=n;if(o==="ok"){let i=s.arguments[0];if(!i)return;let a=S(i),c="match";a.type==="UnaryExpression"&&a.operator==="!"&&(a=S(a.argument),c="doesNotMatch");let l=Cr(a);return l?fa({node:s,assertMethod:c,regexCall:l,extraArgsToRemove:[],context:e}):void 0}if(Uy.has(o))return Xy(s,o,e)}),e.onExit("CallExpression",s=>{r.leave(s)})},Jy={create:Yy,meta:{type:"suggestion",docs:{description:"Prefer `assert.match()`/`assert.doesNotMatch()` over asserting `RegExp#test()` / `String#match()` results.",recommended:"unopinionated"},fixable:"code",schema:[],messages:qy,languages:["js/js"]}},ma=Jy;var da="prefer-assert-throws/sync",ga="prefer-assert-throws/async",Qy={[da]:"Prefer `assert.throws()` over try/catch with an assertion.",[ga]:"Prefer `assert.rejects()` over try/catch with an assertion."};function Zy(e,t,r,s){function n(o){if(I(o))return!1;let i=o.type==="CallExpression"?R(o,t,r):void 0;if(i&&i.method!=="fail")return!0;for(let a of s[o.type]??[]){let c=o[a];for(let l of Array.isArray(c)?c:[c])if(l?.type&&n(l))return!0}return!1}return n(e.body)}var eh=e=>{let t=d(e);if(!t.isAssertOrTestFile)return;let{visitorKeys:r}=e.sourceCode,s=y(t,{trackHooks:!0});e.on("CallExpression",n=>{s.update(n)}),e.onExit("CallExpression",n=>{s.leave(n)}),e.on("TryStatement",n=>{if(!n.handler||n.block.body.length===0||!Zy(n.handler,t,s,r))return;let o=O(n),i=!!(o?.async&&o.generator),a=n.block.body.some(c=>ge(c,r,{includeYield:i}));return{node:n,messageId:a?ga:da}})},th={create:eh,meta:{type:"suggestion",docs:{description:"Prefer `assert.throws()`/`assert.rejects()` over try/catch with an assertion.",recommended:!0},schema:[],messages:Qy,languages:["js/js"]}},ya=th;var Ir="prefer-async-await/error",rh={[Ir]:"Prefer async/await instead of returning a Promise."};function sh(e){let t=[];function r(s){if(s)switch(s.type){case"ReturnStatement":{t.push(s);break}case"BlockStatement":{for(let n of s.body)r(n);break}case"IfStatement":{r(s.consequent),r(s.alternate);break}case"SwitchStatement":{for(let n of s.cases)for(let o of n.consequent)r(o);break}case"TryStatement":{r(s.block),s.handler&&r(s.handler.body),r(s.finalizer);break}case"ForStatement":case"ForInStatement":case"ForOfStatement":case"WhileStatement":case"DoWhileStatement":case"LabeledStatement":case"WithStatement":{r(s.body);break}default:break}}return r(e),t}function Tr(e){for(;e;){if(e=S(e),e.type!=="CallExpression")return!1;let t=S(e.callee);if(t.type!=="MemberExpression")return!1;if(t.property.type==="Identifier"&&t.property.name==="then")return!0;e=t.object}return!1}var nh=e=>{let{sourceCode:t}=e,r=d(e);if(!r.isTestFile)return;let s=y(r,{trackHooks:!0});e.on("CallExpression",n=>{let o=s.isSubtestCall(n),i=N(n,s.isContextReceiver);s.update(n);let a=b(n,r);if(!a&&!o&&!i||a?.kind==="suite")return;let c=i?V(n):v(n,r);if(!c||c.async||c.body.type!=="BlockStatement")return;let l=sh(c.body);if(l.length!==0){for(let u of l)if(Tr(u.argument))return{node:c,messageId:Ir};for(let u of l){if(u.argument?.type!=="Identifier")continue;let p=C(t.getScope(u),u.argument);if(!p)continue;if(p.defs.some(g=>g.type!=="Variable"||g.node.id.type!=="Identifier"?!1:Tr(g.node.init))||p.references.some(g=>{if(!g.isWrite())return!1;let{identifier:h}=g,{parent:k}=h;return k?.type==="AssignmentExpression"&&k.operator==="="&&k.left===h&&Tr(k.right)}))return{node:c,messageId:Ir}}}}),e.onExit("CallExpression",n=>{s.leave(n)})},oh={create:nh,meta:{type:"suggestion",docs:{description:"Prefer async/await over returning a Promise.",recommended:!0},schema:[],messages:rh,languages:["js/js"]}},ha=oh;var Ea="prefer-context-mock",ih={[Ea]:"Prefer `t.mock.{{accessor}}` over the global `mock.{{accessor}}`, which is not automatically restored between tests."},ah=new Set(["fn","method","getter","setter","property","module","timers"]),ch=e=>{let t=d(e);t.isTestFile&&e.on("CallExpression",r=>{let s=S(r.callee),n=s.type==="MemberExpression"&&!s.computed&&s.property.type==="Identifier"?s.property.name:void 0,o=s;for(;o.type==="MemberExpression";){if(J(o.object,t)&&!o.computed&&o.property.type==="Identifier"){let i=o.property.name;return ah.has(i)?i==="timers"&&n!=="enable"?void 0:{node:r,messageId:Ea,data:{accessor:i}}:void 0}o=S(o.object)}})},lh={create:ch,meta:{type:"suggestion",docs:{description:"Prefer the test context `t.mock` over the global `mock`.",recommended:!0},schema:[],messages:ih,languages:["js/js"]}},Sa=lh;var ba="prefer-diagnostic/error",xa="prefer-diagnostic/suggestion",uh={[ba]:"Prefer `{{context}}.diagnostic()` over `console.{{method}}()` inside a test, so the message is attached to the test as a TAP diagnostic.",[xa]:"Replace with `{{context}}.diagnostic()`."},ph=new Set(["log","info","debug"]);function fh(e){if(e?.type!=="MemberExpression"||e.computed||e.property.type!=="Identifier"||e.property.name!=="console")return;let t=S(e.object);return t.type==="Identifier"&&(t.name==="globalThis"||t.name==="global")?t:void 0}var vr=e=>Me(e)||e.type==="BinaryExpression"&&e.operator==="+"&&(vr(e.left)||vr(e.right)),mh=e=>{let t=d(e);if(!t.isTestFile)return;let r=y(t),{getTestContextName:s}=t,n=u=>s&&rt(t,u)?`${s}()`:void 0,o=u=>{for(let p=O(u);p;p=O(p))if(P(D(p,e,t),t,e)==="test")return p},i=(u,p)=>{let[f,g]=e.sourceCode.getRange(p),[h]=e.sourceCode.getRange(u);return h>=f&&h<g},a=(u,p)=>{for(let f=O(u);f&&f!==p;f=O(f)){let g=Oe(f),h=q(f.params);if(h&&g&&V(g)===f&&N(g,r.isContextReceiver))return h}},c=(u,p)=>{let f=C(e.sourceCode.getScope(p),u.name);return f&&f.identifiers.includes(u)&&tt(f)?u.name:void 0},l=u=>{let p=o(u),f=r.currentCallback(),g=f&&i(u,f)&&!(p&&i(p,f)),h=g?f:p;if(!h)return;let k=a(u,h);if(k)return c(k,u);if(g){let x=r.current();return x?r.isContextNameInScope(x,u)?x:void 0:n(u)}let T=q(p.params);return T?c(T,u):n(u)};e.on("CallExpression",u=>{r.update(u);let p=S(u.callee);if(p.type!=="MemberExpression"||p.computed||p.property.type!=="Identifier"||!ph.has(p.property.name))return;let f=S(p.object),g=fh(f);if(!(g!==void 0&&Q(e,g,g.name))&&!Q(e,f,"console"))return;let k=l(u);if(!k)return;let T=p.property.name,x={context:k,method:T},A={node:p,messageId:ba,data:x};return u.arguments.length===1&&vr(u.arguments[0])&&e.sourceCode.getCommentsInside(p).length===0&&(A.suggest=[{messageId:xa,data:x,fix:H=>H.replaceText(p,`${k}.diagnostic`)}]),A}),e.onExit("CallExpression",u=>{r.leave(u)})},dh={create:mh,meta:{type:"suggestion",docs:{description:"Prefer the test context `diagnostic()` over `console` inside tests.",recommended:!1},hasSuggestions:!0,schema:[],messages:uh,languages:["js/js"]}},ka=dh;var Ia="prefer-equality-assertion",gh={[Ia]:"Prefer `{{replacement}}` over `{{method}}` with a `{{operator}}` comparison for a clearer failure message."},yh=new Map([["===","strictEqual"],["!==","notStrictEqual"],["==","equal"],["!=","notEqual"]]),hh=e=>e==="==="||e==="!==",At=e=>e?.type==="Literal"&&typeof e.value=="number",Ca=(e,t)=>e.type==="MemberExpression"&&!e.computed&&e.object.type==="Identifier"&&e.object.name==="Number"&&t.includes(e.property.name);function wr(e){return e=m(e),e.type==="Identifier"?e.name==="NaN":e.type==="MemberExpression"?Ca(e,["NaN"]):e.type==="CallExpression"?e.callee.type==="Identifier"?["Number","parseInt","parseFloat"].includes(e.callee.name):Ca(e.callee,["parseInt","parseFloat"]):e.type==="BinaryExpression"&&e.operator==="/"?At(m(e.left))&&At(m(e.right)):e.type==="UnaryExpression"&&(e.operator==="-"||e.operator==="+")&&wr(e.argument)}function Ta(e){if(e=m(e),At(e))return e.value===0;if(e.type==="UnaryExpression"&&(e.operator==="-"||e.operator==="+")){let t=m(e.argument);return At(t)&&t.value===0}return!1}function Eh(e,t,r,s){return t=ze(t,s)??t,r=ze(r,s)??r,wr(t)||wr(r)?!0:hh(e)&&(Ta(t)||Ta(r))}var Sh=e=>{let{sourceCode:t}=e,r=d(e);if(!r.isAssertOrTestFile)return;let s=y(r,{trackHooks:!0});e.on("CallExpression",n=>{s.update(n);let o=R(n,r,s);if(o?.method!=="ok")return;let[i]=n.arguments,a=i&&m(i);if(a?.type!=="BinaryExpression"||o.isStrict&&(a.operator==="=="||a.operator==="!="))return;let c=yh.get(a.operator);if(!c)return;let l=m(n.callee),u=l.type==="MemberExpression"?l.property.name:"ok",p={node:n,messageId:Ia,data:{method:u,replacement:c,operator:a.operator}};return l.type==="Identifier"&&!r.assertNamespace.has(l.name)||re(a,e)||t.getCommentsInside(a).length>0||Eh(a.operator,a.left,a.right,e)||(p.fix=function*(g){yield l.type==="MemberExpression"?g.replaceText(l.property,c):g.replaceText(l,`${l.name}.${c}`);let h=de(a.left,e)[1],k=de(a.right,e)[0];yield g.replaceTextRange([h,k],", ")}),p}),e.onExit("CallExpression",n=>{s.leave(n)})},bh={create:Sh,meta:{type:"suggestion",docs:{description:"Prefer an equality assertion over a truthiness assertion on a comparison.",recommended:"unopinionated"},fixable:"code",schema:[],messages:gh,languages:["js/js"]}},va=bh;var Ar="prefer-hooks-on-top",xh={[Ar]:"Hook `{{name}}` should come before any test or `describe` in its scope."};function kh(e,t){let r=O(e);for(;r!==t&&r&&Ke(r);)r=O(r);return r===t}var Ch=e=>{let t=d(e);if(!t.isTestFile)return;let r=[{seenTest:!1,function:void 0}],s=new Set,n=y(t,{trackHooks:!0});e.on("CallExpression",i=>{let a=n.isSubtestCall(i),c=N(i,n.isContextReceiver);n.update(i);let l=b(i,t);if(!l&&!a&&!c)return;let u=r.at(-1),p=u.function===O(i),f;if(c?p&&u.seenTest&&(f={node:i,messageId:Ar,data:{name:xe(i)}}):l?.kind==="hook"&&p&&u.seenTest&&(f={node:i,messageId:Ar,data:{name:l.name}}),a||l?.kind==="test"||l?.kind==="suite"){kh(i,u.function)&&(u.seenTest=!0);let g=v(i);g&&(r.push({seenTest:!1,function:g}),s.add(i))}return f});let o=new WeakSet;e.on(j,i=>{let a=P(D(i,e,t),t,e);a!=="test"&&a!=="suite"||(o.add(i),r.push({seenTest:!1,function:i}))}),e.onExit(j,i=>{o.delete(i)&&r.pop()}),e.onExit("CallExpression",i=>{n.leave(i),s.has(i)&&(s.delete(i),r.pop())})},Th={create:Ch,meta:{type:"suggestion",docs:{description:"Require hooks to be declared before the tests in their scope.",recommended:!0},schema:[],messages:xh,languages:["js/js"]}},wa=Th;var Aa="prefer-lowercase-title",Ih={[Aa]:"Start the title with a lowercase letter."},vh=e=>{if(e.type==="Literal"&&typeof e.value=="string")return e.value;if(e.type==="TemplateLiteral")return e.quasis[0].value.cooked||void 0},wh=e=>{let{sourceCode:t}=e,r=d(e);if(!r.isTestFile)return;let{ignore:s,allowedPrefixes:n}=e.options[0],o=y(r);e.on("CallExpression",i=>{let a=o.isSubtestCall(i);o.update(i);let c=b(i,r);if(!a&&c?.kind!=="test"&&c?.kind!=="suite"||!a&&s.includes(c.name))return;let l=fe(i,e);if(!l)return;let u=vh(l);if(!u||n.some(T=>u.startsWith(T)))return;let p=String.fromCodePoint(u.codePointAt(0));if(!new RegExp("\\p{Uppercase_Letter}","u").test(p))return;let f={node:l,messageId:Aa},g=t.getRange(l)[0]+1,h=g+p.length,k=p.toLowerCase();return k!==p&&t.getText(l).slice(1,1+p.length)===p&&(f.fix=T=>T.replaceTextRange([g,h],k)),f}),e.onExit("CallExpression",i=>{o.leave(i)})},Ah={create:wh,meta:{type:"suggestion",docs:{description:"Enforce lowercase test titles.",recommended:!1},fixable:"code",schema:[{type:"object",properties:{ignore:{type:"array",items:{enum:["test","it","describe","suite"]},uniqueItems:!0,description:"Test functions whose titles are not checked."},allowedPrefixes:{type:"array",items:{type:"string"},uniqueItems:!0,description:"Title prefixes that are allowed to start with an uppercase letter."}},additionalProperties:!1}],defaultOptions:[{ignore:[],allowedPrefixes:[]}],messages:Ih,languages:["js/js"]}},Ra=Ah;var ja="prefer-mock-accessor",Oa=new Set(["getter","setter"]),Rh={[ja]:"Prefer `mock.{{accessor}}()` over `mock.method()` with `{{accessor}}: true`."};function Oh(e){let t=new Map;for(let s=e.properties.length-1;s>=0;s-=1){let n=e.properties[s];if(n.type==="SpreadElement"||n.computed&&$(n)===void 0||n.kind==="get")return;let o=$(n);if(o==="__proto__")return;Oa.has(o)&&!t.has(o)&&t.set(o,n)}let r;for(let s of Oa){let n=t.get(s);if(!n)continue;let o=m(n.value);if(o.type==="Literal"&&o.value===!0){if(r)return;r=s}}return r}function jh(e){if(e.arguments.some(r=>r.type==="SpreadElement")||e.arguments.length!==3&&e.arguments.length!==4||e.arguments.length===4&&!I(m(e.arguments[2])))return;let t=m(e.arguments.at(-1));return t.type==="ObjectExpression"?t:void 0}var Ph=e=>{let t=d(e);if(!t.isTestFile)return;let r=y(t,{trackHooks:!0}),s=n=>{if(n=S(n),n.type!=="MemberExpression"||n.computed||n.property.type!=="Identifier"||n.property.name!=="mock")return!1;let o=S(n.object);return o.type==="Identifier"&&r.isContextIdentifier(o)||M(o,t)};e.on("CallExpression",n=>{r.update(n)}),e.onExit("CallExpression",n=>{r.leave(n)}),e.on("CallExpression",n=>{let o=S(n.callee);if(o.type!=="MemberExpression"||o.computed||o.property.type!=="Identifier"||o.property.name!=="method"||!J(S(o.object),t)&&!s(o.object))return;let i=jh(n);if(!i)return;let a=Oh(i);if(a)return{node:o.property,messageId:ja,data:{accessor:a},fix:c=>c.replaceText(o.property,a)}})},Mh={create:Ph,meta:{type:"suggestion",docs:{description:"Prefer `mock.getter()` and `mock.setter()` over `mock.method()` with accessor options.",recommended:!0},fixable:"code",schema:[],messages:Rh,languages:["js/js"]}},Pa=Mh;var Ma="prefer-mock-call-count",Dh={[Ma]:"Prefer `{{mock}}.callCount()` over `{{mock}}.calls.length`, which creates a copy of the call history."},_h=(e,t)=>t.type==="AssignmentExpression"&&t.left===e||t.type==="UpdateExpression"&&t.argument===e||t.type==="UnaryExpression"&&t.operator==="delete"&&t.argument===e||(t.type==="ForInStatement"||t.type==="ForOfStatement")&&t.left===e,Nh=(e,t)=>{if(t.type==="ArrayPattern"||t.type==="ObjectPattern"||t.type==="AssignmentPattern"&&t.left===e||t.type==="RestElement"&&t.argument===e)return t;if(t.type==="Property"&&t.value===e&&t.parent.type==="ObjectPattern")return t.parent},Fh=e=>{let t=e;for(;;){let{parent:r}=t;if(_h(t,r))return!0;if(ne(r)||r.type==="MemberExpression"&&r.object===t){t=r;continue}if(t=Nh(t,r),!t)return!1}},Lh=e=>{let t=Z(e);return t.parent.type==="CallExpression"&&t.parent.callee===t||t.parent.type==="TaggedTemplateExpression"&&t.parent.tag===t},Gh=e=>{for(;;){e=Z(e);let{parent:t}=e;if(t.type==="MemberExpression"&&t.object===e){e=t;continue}return t.type==="NewExpression"&&t.callee===e}},Bh=e=>{if(!d(e).isTestFile)return;let{sourceCode:r}=e;e.on("MemberExpression",s=>{if(s.computed||s.optional||s.property.type!=="Identifier"||s.property.name!=="length"||Fh(s)||Lh(s)||Gh(s))return;let n=s.object;if(n.type!=="MemberExpression"||n.computed||n.optional||n.property.type!=="Identifier"||n.property.name!=="calls")return;let o=n.object;if(o.type!=="MemberExpression"||o.computed||o.optional||o.property.type!=="Identifier"||o.property.name!=="mock")return;let i=r.getText(o);return{node:s,messageId:Ma,data:{mock:i},fix:r.getCommentsInside(s).length===0?a=>a.replaceText(s,`${i}.callCount()`):void 0}})},Hh={create:Bh,meta:{type:"suggestion",docs:{description:"Prefer `mock.callCount()` over `mock.calls.length`.",recommended:"unopinionated"},fixable:"code",schema:[],messages:Dh,languages:["js/js"]}},Da=Hh;var _a=(e,t)=>t.sourceCode.text.slice(...de(e,t)),Na="prefer-mock-method/error",Fa="prefer-mock-method/suggestion",qh={[Na]:"Prefer `{{base}}.method()` over assigning `{{base}}.fn()` to a property, so the original method is tracked and can be restored.",[Fa]:"Replace with `{{base}}.method()`."};function Uh({node:e,left:t,key:r,mockArguments:s,sourceCode:n}){return r!==void 0&&s.length<=1&&kt(e)&&n.getCommentsInside(e).length===0&&t.object.type!=="SequenceExpression"&&t.object.type!=="Super"&&(!t.computed||t.property.type!=="SequenceExpression")&&s.every(o=>o.type!=="SequenceExpression"&&o.type!=="SpreadElement")}function Vh(e){return e=S(e),e.type==="Identifier"&&e.name==="undefined"||e.type==="UnaryExpression"&&e.operator==="void"}var Wh=e=>{let{sourceCode:t}=e,r=d(e);if(!r.isTestFile)return;let s=y(r,{trackHooks:!0}),n=o=>{if(o=S(o),o.type!=="MemberExpression"||o.computed||o.property.type!=="Identifier"||o.property.name!=="mock")return!1;let i=S(o.object);return i.type==="Identifier"&&s.isContextIdentifier(i)||M(i,r)};e.on("CallExpression",o=>{s.update(o)}),e.onExit("CallExpression",o=>{s.leave(o)}),e.on("AssignmentExpression",o=>{let i=S(o.right);if(o.operator!=="="||o.left.type!=="MemberExpression"||i.type!=="CallExpression")return;let a=S(i.callee);if(a.type!=="MemberExpression"||a.computed||a.property.type!=="Identifier"||a.property.name!=="fn"||!J(a.object,r)&&!n(a.object))return;let c=_a(a.object,e),l={node:o,messageId:Na,data:{base:c}},{left:u}=o,p=i.arguments,f;if(!u.computed&&u.property.type==="Identifier"?f=`'${u.property.name}'`:u.computed&&me(u.property,e)!==void 0&&(f=t.getText(u.property)),p.length===1&&!Vh(p[0])&&S(p[0]).type!=="ObjectExpression"&&Uh({node:o,left:u,key:f,mockArguments:p,sourceCode:t})){let h=_a(u.object,e),k=p.length===1?`, ${t.getText(p[0])}`:"",T=`${c}.method(${h}, ${f}${k})`,x=lt(o,o.parent,T,e)?";":"";l.suggest=[{messageId:Fa,data:{base:c},fix:A=>A.replaceText(o,`${x}${T}`)}]}return l})},$h={create:Wh,meta:{type:"suggestion",docs:{description:"Prefer `mock.method()` over assigning `mock.fn()` to an object property.",recommended:!0},hasSuggestions:!0,schema:[],messages:qh,languages:["js/js"]}},La=$h;var Ba="prefer-strict-assert",Kh={[Ba]:"Prefer `{{replacement}}` over the legacy loose `{{method}}`."};function Ga(e){return e===null||typeof e!="object"&&typeof e!="function"}function zh(e,t,r){if(!e||!t)return!1;let s=B(S(e),r.sourceCode.getScope(e)),n=B(S(t),r.sourceCode.getScope(t));if(s===null||n===null)return!1;let o=s.value,i=n.value;return!Ga(o)||!Ga(i)?!0:(o===i||Number.isNaN(o)&&Number.isNaN(i)||o==i)!==Object.is(o,i)}var Xh=e=>{let t=d(e);if(!t.isAssertOrTestFile)return;let r=y(t,{trackHooks:!0});e.on("CallExpression",s=>{r.update(s);let n=R(s,t,r);if(!n||n.isStrict)return;let o=je.get(n.method);if(!o)return;let i={node:s,messageId:Ba,data:{method:n.method,replacement:o}},a=n.methodNode===S(s.callee);return n.methodNode&&!a&&!zh(s.arguments[0],s.arguments[1],e)&&(i.fix=c=>c.replaceText(n.methodNode,o)),i}),e.onExit("CallExpression",s=>{r.leave(s)})},Yh={create:Xh,meta:{type:"suggestion",docs:{description:"Prefer strict assertion methods over their legacy loose counterparts.",recommended:"unopinionated"},fixable:"code",schema:[],messages:Kh,languages:["js/js"]}},Ha=Yh;var Ua="prefer-test-context-assert/error",Va="prefer-test-context-assert/suggestion",Jh={[Ua]:"Prefer the test context `{{context}}.assert.{{method}}()` over the imported `node:assert`, so the runner ties the assertion to this test.",[Va]:"Replace with `{{context}}.assert.{{method}}()`."};function Qh(e,t){if(e.type==="Identifier"&&(t.assertNamed.has(e.name)||t.assertNamespace.has(e.name)))return!0;if(e.type!=="MemberExpression"||e.computed)return!1;let r=m(e.object);if(r?.type==="Identifier"&&(t.assertNamespace.has(r.name)||t.assertNamed.get(r.name)==="strict"))return!0;let s=r?.type==="MemberExpression"?m(r.object):void 0;return s?.type==="Identifier"&&!r.computed&&r.property.type==="Identifier"&&r.property.name==="strict"&&t.assertNamespace.has(s.name)}function Zh(e,t){let r=te(e,t);if(!(!r||!Qh(m(e.callee),t)))return r.isStrict&&je.get(r.method)||r.method}function qa(e,t,r){let[s,n]=r.getRange(t),[o]=r.getRange(e);return o>=s&&o<n}var eE=e=>{let{sourceCode:t}=e,r=d(e);if(!r.hasAssert||!r.isTestFile)return;let s=y(r),{getTestContextName:n}=r,o=n?`${n}()`:void 0,i=[];e.on(j,l=>{let u=D(l,e,r);P(u,r,e)==="test"&&i.push(l)}),e.onExit(j,l=>{i.at(-1)===l&&i.pop()});let a=l=>s.current()?s.isContextNameInScope(s.current(),l)?s.current():void 0:rt(r,l)?o:void 0,c=(l,u)=>{let p=q(u.params);if(!p)return rt(r,l)?o:void 0;let f=C(t.getScope(l),p.name);return f?.defs.length===1&&f.defs[0].type==="Parameter"&&f.defs[0].node===u?p.name:void 0};e.on("CallExpression",l=>{s.update(l);let u=Zh(l,r);if(!u)return;let p=s.currentCallback(),f=i.at(-1),g=p!==void 0&&qa(l,p,t)&&(f===void 0||qa(p,f,t)),h;if(g?h=a(l):f&&(h=c(l,f)),!h)return;let k={context:h,method:u},T={node:l.callee,messageId:Ua,data:k};return t.getCommentsInside(l.callee).length===0&&(T.suggest=[{messageId:Va,data:k,fix:x=>x.replaceText(l.callee,`${h}.assert.${u}`)}]),T}),e.onExit("CallExpression",l=>{s.leave(l)})},tE={create:eE,meta:{type:"suggestion",docs:{description:"Prefer the test context `t.assert` over the imported `node:assert`.",recommended:!0},hasSuggestions:!0,schema:[],messages:Jh,languages:["js/js"]}},Wa=tE;function rE(e){let t=e,{parent:r}=t;for(;ne(r);)t=r,r=t.parent;return r?.type==="CallExpression"||r?.type==="NewExpression"?{argument:t,call:r}:void 0}function sE(e,t){let r=rE(e);if(!r)return[0,0];let{argument:s,call:n}=r,o=n.arguments.indexOf(s),i=Pe(s,t),a=i[0]||s,c=i.at(-1)||s,{sourceCode:l}=t,[u]=l.getRange(a),[,p]=l.getRange(c);if(n.arguments.length===1){let f=l.getTokenAfter(c);Lt(f)&&([,p]=l.getRange(f))}else if(o===0){let f=l.getTokenAfter(c),g=l.getTokenAfter(f);[p]=l.getRange(g)}else{let f=l.getTokenBefore(a);[u]=l.getRange(f)}return[u,p]}function Rt(e,t,r){let[s,n]=sE(t,r),{sourceCode:o}=r,i=o.getTokenBefore({range:[s,s]}),a=o.getTokenAfter({range:[n,n]}),c=[i?o.getRange(i)[1]:s,a?o.getRange(a)[0]:n];if(!(o.getCommentsInside({range:c}).length>0))return e.removeRange([s,n])}var $a="prefer-todo/error",Ka="prefer-todo/error-subtest",za="prefer-todo/suggestion",Xa="prefer-todo/suggestion-subtest",nE={[$a]:"Empty placeholder test. Use `.todo` to mark it as unfinished.",[Ka]:"Empty placeholder subtest. Use the `todo` option to mark it as unfinished.",[za]:"Mark as `.todo`.",[Xa]:"Mark with `{todo: true}`."};function oE(e,t){let r=t.getRange(t.getTokenBefore(e))[1];return t.getCommentsBefore(e).some(s=>t.getRange(s)[0]>=r)}var iE=new Set(["fn","name"]);function aE(e){let t=F(e);return!!t&&t.properties.some(r=>r.type!=="Property"||r.computed||!iE.has(r.key.name??r.key.value))}function cE(e){return W(F(e),"fn")!==void 0}function lE(e,t,r,s){return r&&F(e)?!1:t?m(e.arguments.at(-1))!==t?!1:s.getCommentsInside(t).length===0&&!oE(t,s)&&s.getCommentsAfter(t).length===0:!0}var uE=e=>{let{sourceCode:t}=e,r=d(e);if(!r.isTestFile)return;let s=y(r,{trackHooks:!0});e.on("CallExpression",n=>{let o=s.isSubtestCall(n);s.update(n);let i=b(n,r);if(!o&&(i?.kind!=="test"||i.hasExpectedFailure||i.modifiers.length>0)||!fe(n,e)||aE(n))return;let a=v(n),c=!a&&!cE(n)&&n.arguments.length===1,l=a?.body.type==="BlockStatement"&&a.body.body.length===0;if(!c&&!l)return;let{callee:u}=n,p=lE(n,a,o,t),f={node:n,messageId:o?Ka:$a};return p&&(f.suggest=[{messageId:o?Xa:za,*fix(g,{abort:h}){if(o){yield a?g.replaceText(a,"{todo: true}"):g.insertTextAfter(n.arguments.at(-1),", {todo: true}");return}let k=a&&Rt(g,a,e);if(a&&!k)return h();yield g.insertTextAfter(m(u),".todo"),k&&(yield k)}}]),f}),e.onExit("CallExpression",n=>{s.leave(n)})},pE={create:uE,meta:{type:"suggestion",docs:{description:"Prefer `.todo` for empty placeholder tests.",recommended:!0},hasSuggestions:!0,schema:[],messages:nE,languages:["js/js"]}},Ya=pE;var Qa="require-assertion/error",fE={[Qa]:"Test is missing an assertion, so a wrong result nothing checks goes unnoticed."};function mE(e,t,r){let s=ee(e.callee);if(!s||s.members.length>1)return!1;let n=C(r.getScope(s.root),s.root);if(n===null)return!1;let o=s.members.length===0;return t.some(i=>{if(!i.assertBindings.has(n))return!1;let a=i.assertBindings.get(n);return o?typeof a=="string"&&a!=="strict":a===void 0&&s.members[0].name!=="strict"})}function Ja(e,t){return t.findLast(r=>{for(let s=e.parent;s;s=s.parent)if(s===r.callback)return!0;return!1})}var dE=e=>{let{sourceCode:t}=e,r=d(e);if(!r.isTestFile)return;let s=[],n=y(r);e.on("CallExpression",o=>{n.update(o);let i=b(o,r);if(i&&i.kind==="test"){let c=v(o);if(c){s.push({callNode:o,callback:c,assertBindings:We(c,r),skipped:ye(o,i,e)||Ja(o,s)?.skipped===!0,hasAssertion:!1});return}return}if(i?.kind==="suite"&&ye(o,i,e)){let c=v(o);c&&s.push({callNode:o,callback:c,assertBindings:new Map,skipped:!0,hasAssertion:!1});return}let a=Ja(o,s);!a||a.skipped||(R(o,r,n)||mE(o,s,t))&&(a.hasAssertion=!0)}),e.onExit("CallExpression",o=>{if(n.leave(o),s.length===0)return;let i=s.at(-1);if(i.callNode===o&&(s.pop(),!i.skipped&&!i.hasAssertion))return{node:o,messageId:Qa}})},gE={create:dE,meta:{type:"problem",docs:{description:"Require that each test contains at least one assertion.",recommended:!0},schema:[],messages:fE,languages:["js/js"]}},Za=gE;var tc="require-await-concurrent-subtests",yE={[tc]:"Subtests created in a `{{method}}()` callback are not awaited, so the test continues while they run. Use `await Promise.all(items.map(item => t.test(\u2026)))`."},hE=new Set(["map","forEach","flatMap"]);function EE(e){let t=e.parent;for(;t;){if(I(t)){let{parent:r}=t;return r?.type==="CallExpression"&&r.callee.type==="MemberExpression"&&!r.callee.computed&&r.callee.property.type==="Identifier"&&hE.has(r.callee.property.name)&&r.arguments.includes(t)?r:void 0}t=t.parent}}function ec(e){let{parent:t}=e;return t?.type==="CallExpression"&&t.callee.type==="MemberExpression"&&!t.callee.computed&&t.callee.property.type==="Identifier"&&(t.callee.property.name==="all"||t.callee.property.name==="allSettled")&&t.callee.object.type==="Identifier"&&t.callee.object.name==="Promise"&&t.arguments.includes(e)&&!Y(t)}function SE(e,t){let r=Z(e);if(ec(r))return!0;let{parent:s}=r;if(s?.type!=="VariableDeclarator"||s.init!==r||s.id.type!=="Identifier")return!1;let[n]=t.getDeclaredVariables(s);return n.references.some(o=>ec(Z(o.identifier)))}var bE=e=>{let{sourceCode:t}=e,r=d(e);if(!r.isTestFile)return;let s=y(r);e.on("CallExpression",n=>{let o=s.isSubtestCall(n),i;if(o&&!Y(n)){let a=EE(n);if(a){let c=a.callee.property.name;c!=="forEach"&&SE(a,t)||(i={node:n,messageId:tc,data:{method:c}})}}return s.update(n),i}),e.onExit("CallExpression",n=>{s.leave(n)})},xE={create:bE,meta:{type:"problem",docs:{description:"Require subtests created in an array-iteration callback to be awaited.",recommended:"unopinionated"},schema:[],messages:yE,languages:["js/js"]}},rc=xE;var sc="require-context-assert-with-plan",kE={[sc]:"This assertion is not counted toward the test's plan. Use `{{context}}.assert` so the runner counts it."};function CE(e,t){let r=q(e?.params);return r?C(t.getScope(r),r):void 0}function TE(e,t,r){let s=m(e.callee);if(s?.type!=="MemberExpression"||s.computed||s.property.type!=="Identifier"||s.property.name!=="plan")return null;let[n]=e.arguments;if(n){let i=B(n,t.sourceCode.getScope(n));if(i&&!Yt(i))return null}let o=m(s.object);return M(o,r)?"getTestContext()":o}function IE(e){if(e.getTestContextName)return`${e.getTestContextName}()`;let t=[...e.namespaces][0]??[...e.locals].find(([,r])=>r==="test"||r==="it")?.[0];return t?`${t}.getTestContext()`:void 0}var vE=e=>{let{sourceCode:t}=e,r=d(e);if(!r.isTestFile||!r.hasAssert)return;let s=y(r,{trackHooks:!0}),n=IE(r),o=[],i=new WeakSet,a=({node:u,call:p,callback:f,hookName:g,isContextHook:h,contextName:k})=>{let T=g!==void 0,x=CE(f,t),A=!T&&St(p,e);o.push({node:u,contextName:k,contextKey:x??void 0,hasPlan:A,isPlanChecked:!T||g==="beforeEach"||g==="before"&&h,planName:A?k??n:void 0,assertions:[]})},c=u=>{if(o.at(-1)?.node!==u)return;let p=o.pop();if(!(!p.isPlanChecked||!p.hasPlan||p.planName===void 0))return p.assertions.map(f=>({node:f,messageId:sc,data:{context:p.planName}}))},l=(u,p,f)=>{if(!(p||f)||!ye(u,p,e))return!1;let g=v(u);return g&&i.add(g),!0};e.on("CallExpression",u=>{let p=b(u,r),f=s.isSubtestCall(u),g=N(u,s.isContextReceiver),h=p?.kind==="hook"?p.name:g?m(u.callee).property.name:void 0,k=p?.kind==="test"||f||h!==void 0;if(s.update(u),l(u,p,f))return;if(k){a({node:u,call:u,callback:h===void 0?v(u):V(u),hookName:h,isContextHook:g,contextName:s.current()});return}if(o.length===0||Xe(u,i))return;let T=TE(u,e,r);if(T!==null){let A=T==="getTestContext()"?o.at(-1)?.contextKey:C(t.getScope(T),T);for(let H=o.length-1;H>=0;H-=1)if(o[H].contextKey===A){o[H].hasPlan=!0,o[H].planName=T==="getTestContext()"?n:o[H].contextName;break}return}let x=te(u,r);x&&!x.contextReceiver&&o.at(-1).assertions.push(u)}),e.onExit("CallExpression",u=>(s.leave(u),c(u))),e.on(j,u=>{let p=D(u,e,r),f=P(p,r,e);if(f===void 0)return;let g=b(p,r);if(ye(p,g,e)){i.add(u);return}if(f!=="test"&&f!=="hook")return;let h=f==="hook"&&g?.kind!=="hook",k=h?m(p.callee).property.name:g?.name;a({node:u,call:p,callback:u,hookName:f==="hook"?k:void 0,isContextHook:h,contextName:q(u.params)?.name})}),e.onExit(j,c)},wE={create:vE,meta:{type:"problem",docs:{description:"Require assertions to use the test context when the test sets a plan.",recommended:"unopinionated"},schema:[],messages:kE,languages:["js/js"]}},nc=wE;var oc="require-hook",AE={[oc]:"This runs when the file is loaded, not as part of a test. Move it into a `before`, `beforeEach`, `after`, or `afterEach` hook."},RE=new Set(["void","!","typeof","+","-","~"]);function ic(e){let t=S(e.expression);for(;t.type==="AwaitExpression"||t.type==="UnaryExpression"&&RE.has(t.operator);)t=S(t.argument);return t}function OE(e,t,r){let{parent:s}=e;if(s.type==="Program")return!0;if(s.type!=="BlockStatement")return!1;let n=s.parent;if(!I(n))return!1;let o=Z(n).parent;if(o?.type==="Property"&&o.parent?.type==="ObjectExpression"&&(o=o.parent.parent),o?.type==="CallExpression"){if(v(o,t)!==n)return!1}else o=D(n,r,t);return o!==void 0&&b(o,t)?.kind==="suite"}function jE(e,t,r){let s=o=>{let i=o.type==="ExpressionStatement"?ic(o):o;return i.type==="CallExpression"&&!!b(i,t)},n=[e.callee,...e.arguments].map(o=>S(o)).filter(o=>I(o));return n.length>0&&n.every(o=>r.has(o)&&(o.body.type==="BlockStatement"?o.body.body.every(i=>i.type!=="ExpressionStatement"||s(i)):s(o.body)))}var PE=e=>{let{sourceCode:t}=e,r=d(e);if(!r.isTestFile)return;let s=new Set(e.options[0].allow),n=new Set;e.on("CallExpression",o=>{b(o,r)&&n.add(O(o))}),e.onExit("ExpressionStatement",o=>{let i=ic(o);if(i.type==="CallExpression"&&!b(i,r)&&!te(i,r)&&OE(o,r,e)&&!jE(i,r,n)&&!(s.size>0&&s.has(t.getText(i.callee))))return{node:o,messageId:oc}})},ME={create:PE,meta:{type:"suggestion",docs:{description:"Require setup and teardown code to be inside a hook.",recommended:!1},schema:[{type:"object",properties:{allow:{type:"array",items:{type:"string"},uniqueItems:!0,description:'Callee expressions allowed at the top level (for example, `["console.log"]`).'}},additionalProperties:!1}],defaultOptions:[{allow:[]}],messages:AE,languages:["js/js"]}},ac=ME;var lc="require-mock-timers-advance",DE={[lc]:"`mock.timers.enable()` must be followed by `tick()` or `runAll()` so mocked timer callbacks can run."},_E=new Set(["tick","runAll"]);function Ot(e){if(e.type==="Identifier")return e.name;if(e.type==="Literal"&&typeof e.value=="string")return e.value}function NE(e){return e.type==="Property"&&e.computed&&e.key.type!=="Literal"}function FE(e){let t=m(e.arguments[0]);if(t?.type!=="ObjectExpression")return!0;let r;for(let n of t.properties){if(n.type==="SpreadElement"){if(r)return!0;continue}if($(n)==="apis")r=n.value;else if(r&&NE(n))return!0}if(!r)return!0;let s=m(r);if(s.type!=="ArrayExpression")return!0;for(let n of s.elements){let o=n&&m(n);if(o){if(o.type!=="Literal"||typeof o.value!="string")return!0;if(o.value!=="Date")return!0}}return!1}function LE(e,t){return C(t.getScope(e),e)?.defs.some(({type:s})=>s==="ImportBinding")??!1}function GE(e,t,r,s){if(e?.type!=="MemberExpression"||e.computed||e.optional||Ot(e.property)!=="mock")return;let n=m(e.object);if(M(n,t)){let i=s.at(-1);return`context:${i?i.name:"getTestContext()"}`}if(n?.type!=="Identifier")return;let o=C(r.getScope(n),n);if(!(!o||!s.includes(o)))return`context:${n.name}`}function BE(e,t,r,s){if(e=m(e),e.type!=="MemberExpression"||e.computed||e.optional||Ot(e.property)!=="timers")return;let n=m(e.object);return J(n,t)?"global":GE(n,t,r,s)}function cc(e,t,r,s){let n=m(e.callee);if(n.type!=="MemberExpression"||n.computed||n.optional)return;let o=Ot(n.property),i=BE(n.object,t,r,s);if(!(!o||!i))return{method:o,receiverKey:i}}function HE(e,t){for(let r of e.pending)!r.satisfied&&r.receiverKey===t&&(r.satisfied=!0)}function qE(e,t){let r=q(e.params);if(r)return C(t.getScope(r),r)}function UE(e){for(;e.type==="MemberExpression"&&!e.computed&&!e.optional;)e=e.object;return e.type==="Identifier"?e:void 0}function Rr(e){return e.map(t=>t.contextVariable).filter(Boolean)}function VE(e,t,r,s){let n=Rr(s),o=K(e);if(o){let u=C(r.getScope(o),o);return u&&n.includes(u)?"test":void 0}let i=m(e.callee);if(i?.type!=="MemberExpression"||i.computed||i.optional)return;let a=m(i.object),c=Ot(i.property);if(s.length>0&&M(a,t))return c==="test"?"test":Ce.has(c)?"hook":void 0;if(a?.type!=="Identifier"||!Ce.has(c))return;let l=C(r.getScope(a),a);return l&&n.includes(l)?"hook":void 0}function WE(e,t,r,s){let n=b(e,t),o=UE(e.callee);if((n?.kind==="test"||n?.kind==="hook")&&n.modifiers.every(a=>_.has(a.name))&&o&&LE(o,r))return v(e);let i=VE(e,t,r,s);return i==="test"||i==="hook"?v(e):void 0}var $E=e=>{let{sourceCode:t}=e,r=d(e);if(!r.isTestFile)return;let s=[];e.on("CallExpression",n=>{let o=WE(n,r,t,s);if(o){let c=qE(o,t);s.push({callNode:n,callback:o,contextVariable:c,pending:[]})}if(s.length===0)return;let i=s.at(-1);if(O(n)!==i.callback)return;let a=cc(n,r,t,Rr(s));a&&_E.has(a.method)&&HE(i,a.receiverKey)}),e.onExit("CallExpression",n=>{let o,i=s.at(-1);i?.callNode===n&&(s.pop(),o=i.pending.filter(c=>!c.satisfied).map(c=>({node:c.node,messageId:c.messageId})));let a=s.at(-1);if(a&&O(n)===a.callback){let c=cc(n,r,t,Rr(s));c?.method==="enable"&&FE(n)&&a.pending.push({node:n,messageId:lc,receiverKey:c.receiverKey,satisfied:!1})}return o})},KE={create:$E,meta:{type:"problem",docs:{description:"Require mock timers to be advanced after enabling timer APIs.",recommended:!0},schema:[],messages:DE,languages:["js/js"]}},uc=KE;var fc="require-mock-timers-apis",zE=new Set(["ArrayExpression","Literal","TemplateLiteral"]),XE={[fc]:"`mock.timers.enable()` should explicitly specify the `apis` option to avoid unexpectedly mocking `Date`."};function pc(e){let t=m(e);return t?t.type==="Identifier"&&t.name==="undefined"||t.type==="UnaryExpression"&&t.operator==="void"||t.type==="Literal"&&!t.value:!0}function YE(e){return zE.has(e.type)}function JE(e){return e.type==="Property"&&$(e)==="apis"}function QE(e){for(let t=e.properties.length-1;t>=0;t-=1){let r=e.properties[t];if(r.type==="SpreadElement")return;if(JE(r))return r}}function ZE(e){let t=m(e.arguments[0]);if(!t||pc(t))return!0;if(t.type!=="ObjectExpression")return YE(t);let r=QE(t);return!r||pc(r.value)}var eS=e=>{let t=d(e);if(!t.isTestFile)return;let r=y(t,{trackHooks:!0}),s=o=>{let i=m(o);if(i.type!=="MemberExpression"||i.computed||i.property.type!=="Identifier"||i.property.name!=="mock")return!1;let a=m(i.object);return r.isContextIdentifier(a)||M(a,t)},n=o=>{let i=m(o);return i.type==="MemberExpression"&&!i.computed&&i.property.type==="Identifier"&&i.property.name==="timers"&&(J(m(i.object),t)||s(i.object))};e.on("CallExpression",o=>{r.update(o)}),e.onExit("CallExpression",o=>{r.leave(o)}),e.on("CallExpression",o=>{let i=m(o.callee);if(i.type==="MemberExpression"&&!i.computed&&i.property.type==="Identifier"&&i.property.name==="enable"&&n(i.object)&&ZE(o))return{node:o,messageId:fc}})},tS={create:eS,meta:{type:"problem",docs:{description:"Require an explicit `apis` option when enabling `mock.timers`.",recommended:"unopinionated"},schema:[],messages:XE,languages:["js/js"]}},mc=tS;var Or="require-throws-expectation",rS=new Set(["NaN","Infinity"]),sS={[Or]:"`{{method}}()` accepts any thrown value. Pass an error matcher (error class, `RegExp`, validation object, or function) as the second argument."},nS=new Set(["throws","rejects"]);function oS(e){return e===void 0||e.type==="Identifier"&&e.name==="undefined"||e.type==="UnaryExpression"&&e.operator==="void"||e.type==="Literal"&&e.value===null}function iS(e){return e.type==="Literal"?!e.regex&&typeof e.value!="string":e.type==="Identifier"&&rS.has(e.name)||e.type==="UnaryExpression"&&e.operator!=="void"||e.type==="ObjectExpression"&&aS(e)||e.type==="ArrayExpression"&&e.elements.length===0}function aS(e){return e.properties.every(t=>t.type==="Property"&&t.kind==="init"&&!t.method&&!t.computed&&!t.shorthand&&(t.key.type==="Identifier"?t.key.name:t.key.value)==="__proto__")}var cS=e=>{let t=d(e);if(!t.isAssertOrTestFile)return;let r=y(t,{trackHooks:!0});e.on("CallExpression",s=>{r.update(s);let n=R(s,t,r);if(!n||!nS.has(n.method))return;let[o]=s.arguments;if(!o||o.type==="SpreadElement")return;let i=s.arguments[1]&&m(s.arguments[1]);if(i?.type!=="SpreadElement"){if(oS(i))return{node:s,messageId:Or,data:{method:n.method}};if(iS(i))return{node:i,messageId:Or,data:{method:n.method}}}}),e.onExit("CallExpression",s=>{r.leave(s)})},lS={create:cS,meta:{type:"problem",docs:{description:"Require an error matcher for `assert.throws()`/`assert.rejects()`.",recommended:"unopinionated"},schema:[],messages:sS,languages:["js/js"]}},dc=lS;var gc="require-throws-validator-return-true",uS={[gc]:"Validator function passed to `assert.{{method}}()` must return the boolean value `true`."},pS=new Set(["throws","rejects"]),fS=new Set(["ArrayExpression","ArrowFunctionExpression","ClassExpression","FunctionExpression","NewExpression","ObjectExpression","TemplateLiteral"]);function mS(e,t){return e=m(e),e.type==="CallExpression"&&te(e,t)!==void 0}function dS(e){return e.type==="CallExpression"&&e.callee.type==="MemberExpression"&&!e.callee.computed&&e.callee.object.type==="Identifier"&&e.callee.object.name==="Promise"&&e.callee.property.type==="Identifier"}function yc(e,t,r){if(!e||(e=m(e),mS(e,r))||dS(e))return!1;let s=B(e,t.sourceCode.getScope(e));return s?s.value===!0:!fS.has(e.type)}function gS(e,t,r){function s(n){if(n.type==="ReturnStatement")return yc(n.argument,t,r);if(n!==e&&I(n))return!1;for(let o of t.sourceCode.visitorKeys[n.type]??[]){let i=n[o];for(let a of Array.isArray(i)?i:[i])if(a?.type&&s(a))return!0}return!1}return s(e)}function yS(e,t,r){return e.async||e.generator?!1:e.body.type!=="BlockStatement"?yc(e.body,t,r):gS(e.body,t,r)}var hS=e=>{let t=d(e);if(!t.isAssertOrTestFile)return;let r=y(t,{trackHooks:!0});e.on("CallExpression",s=>{r.update(s);let n=R(s,t,r);if(!n||!pS.has(n.method))return;let o=m(s.arguments[1]);if(!(!o||!I(o))&&!yS(o,e,t))return{node:o,messageId:gc,data:{method:n.method}}}),e.onExit("CallExpression",s=>{r.leave(s)})},ES={create:hS,meta:{type:"problem",docs:{description:"Require validator functions in `assert.throws()`/`assert.rejects()` to return `true`.",recommended:"unopinionated"},schema:[],messages:uS,languages:["js/js"]}},hc=ES;var Ec="require-top-level-describe/not-wrapped",Sc="require-top-level-describe/too-many",SS={[Ec]:"A {{kind}} must be placed inside a top-level `describe`.",[Sc]:"There should be no more than {{max}} top-level `describe` blocks in a file."};function bS(e){for(let t=O(e);t;t=O(t))if(!Ke(t))return!1;return!0}var xS=e=>{let t=d(e);if(!t.isTestFile)return;let r=e.options[0]?.maxTopLevelDescribes,s=Ve(),n=0;e.on("CallExpression",o=>{let i=b(o,t);if(!i)return;let a=s.depth===0&&bS(o),c;return a&&(i.kind==="test"||i.kind==="hook"?c={node:o,messageId:Ec,data:{kind:i.kind==="hook"?"hook":"test"}}:i.kind==="suite"&&(n+=1,r!==void 0&&n>r&&(c={node:o,messageId:Sc,data:{max:r}}))),i.kind==="suite"&&s.enterSuite(o),c}),e.onExit("CallExpression",o=>{s.exitSuite(o)})},kS={create:xS,meta:{type:"suggestion",docs:{description:"Require tests and hooks to be inside a top-level `describe`.",recommended:!1},schema:[{type:"object",properties:{maxTopLevelDescribes:{type:"integer",minimum:1,description:"The maximum number of top-level `describe` blocks allowed in a file."}},additionalProperties:!1}],defaultOptions:[{}],messages:SS,languages:["js/js"]}},bc=kS;var xc="test-title-format/mismatch",CS={[xc]:"Test title does not match the required format: `{{format}}`."},TS=e=>{let t=d(e);if(!t.isTestFile)return;let r=e.options[0]?.format;if(!r)return;let s=ct(r,"test-title-format","format"),n=y(t);e.on("CallExpression",o=>{let i=n.isSubtestCall(o);n.update(o);let a=b(o,t);if(!a&&!i||a?.kind==="hook")return;let c=fe(o,e);if(!c)return;let l=me(c,e);if(l!==void 0&&!s.test(l))return{node:o,messageId:xc,data:{format:String(s)}}}),e.onExit("CallExpression",o=>{n.leave(o)})},IS={create:TS,meta:{type:"suggestion",docs:{description:"Require test titles to match a configured pattern.",recommended:!1},schema:[{type:"object",properties:{format:{type:"string",description:"A regular expression pattern that test titles must match."}},additionalProperties:!1}],defaultOptions:[{}],messages:CS,languages:["js/js"]}},kc=IS;var vS={"\n":String.raw`\n`,"\r":String.raw`\r`," ":String.raw`\t`,"\b":String.raw`\b`,"\f":String.raw`\f`,"\v":String.raw`\v`,"\0":String.raw`\u{0}`};function wS(e){return e<=31||e===127||e===8232||e===8233||e>=55296&&e<=57343}function pt(e,t="'"){if(typeof e!="string")throw new TypeError("Expected a string.");if(t!=="'"&&t!=='"')throw new TypeError("Expected `quote` to be either `'` or `\"`.");let r=[...e].map(s=>{if(s==="\\")return String.raw`\\`;if(s===t)return`\\${t}`;let n=s.codePointAt(0);return wS(n)?vS[s]??String.raw`\u{${n.toString(16)}}`:s}).join("");return`${t}${r}${t}`}var jr="test-title/missing",Cc="test-title/not-string",Tc="test-title/empty",Pr="test-title/whitespace",AS={[jr]:"Test must have a title.",[Cc]:"Test title must be a string.",[Tc]:"Test title must not be empty.",[Pr]:"Test title must not have leading or trailing whitespace."};function RS(e,t){let{sourceCode:r}=t,s;if(e.type==="TemplateLiteral"&&e.expressions.length===0)s=e.quasis[0].value.cooked;else if(e.type==="Literal")s=e.value;else{let n=B(e,r.getScope(e));if(n===null||typeof n.value=="function"||typeof n.value=="object"&&n.value!==null)return;s=n.value}if(typeof s!="string")return{node:e,messageId:Cc};if(s.trim()==="")return{node:e,messageId:Tc};if(s!==s.trim()){if(!(e.type==="Literal"||e.type==="TemplateLiteral"&&e.expressions.length===0))return{node:e,messageId:Pr};let o=e.type==="Literal"?e.raw[0]:"'",i=s.trim();return{node:e,messageId:Pr,fix:a=>a.replaceText(e,pt(i,o))}}}var OS=e=>{let t=d(e);if(!t.isTestFile)return;let r=y(t);e.on("CallExpression",s=>{let n=r.isSubtestCall(s);r.update(s);let o=b(s,t);if(!o&&!n||o?.kind==="hook")return;let i=m(s.arguments[0]);if(!i)return;let a=zt(s);if(a)return RS(a,e);if(v(s)===i)return{node:s,messageId:jr};if(i.type==="ObjectExpression"&&i.properties.every(l=>l.type!=="SpreadElement"&&!l.computed))return{node:s,messageId:jr}}),e.onExit("CallExpression",s=>{r.leave(s)})},jS={create:OS,meta:{type:"problem",docs:{description:"Require tests to have a title.",recommended:!0},fixable:"code",schema:[],messages:AS,languages:["js/js"]}},Ic=jS;var vc="valid-describe-callback/return",PS={[vc]:"The `{{name}}` callback should not return a value, an implicit return registers tests through the returned expression instead of statements. Use a block body."},MS=e=>{let t=d(e);if(!t.isTestFile)return;let r=new Set;e.on("CallExpression",function*(s){let n=b(s,t);if(n?.kind!=="suite")return;let o=ie(s,e,t);!o||r.has(o)||(r.add(o),o.type==="ArrowFunctionExpression"&&o.body.type!=="BlockStatement"&&(yield{node:o.body,messageId:vc,data:{name:n.name}}))})},DS={create:MS,meta:{type:"problem",docs:{description:"Enforce valid `describe` callbacks.",recommended:"unopinionated"},schema:[],messages:PS,languages:["js/js"]}},wc=DS;var Ac="valid-test-tags/not-array",Rc="valid-test-tags/hole",Oc="valid-test-tags/not-string",jc="valid-test-tags/empty",Pc="valid-test-tags/lowercase",Mc="valid-test-tags/forbidden-character",Dc="valid-test-tags/reserved-word",_c="valid-test-tags/duplicate",_S=new Set(["expectFailure",..._]),NS=/[\t\n\v\f\r !&()*|]/,FS=new Set(["and","or","not"]),LS={[Ac]:"`tags` must be an array.",[Rc]:"`tags` must not contain empty slots.",[Oc]:"Tag values must be strings.",[jc]:"Tag values must not be empty.",[Pc]:"Tag `{{tag}}` must use its lowercase canonical form.",[Mc]:"Tag `{{tag}}` must not contain whitespace or any of `&`, `|`, `!`, `(`, `)`, `*`.",[Dc]:"Tag `{{tag}}` must not be the reserved word `and`, `or`, or `not`.",[_c]:"Duplicate tag `{{tag}}`."};function GS(e){if(e=m(e),e.type==="Literal"&&typeof e.value=="string")return{node:e,value:e.value};if(e.type==="TemplateLiteral"&&e.expressions.length===0){let t=e.quasis[0].value.cooked;if(typeof t=="string")return{node:e,value:t}}}function Nc(e){return e=m(e),e.type==="Literal"||e.type==="TemplateLiteral"&&e.expressions.length===0||e.type==="ArrayExpression"||e.type==="ObjectExpression"||e.type==="FunctionExpression"||e.type==="ArrowFunctionExpression"||e.type==="ClassExpression"||e.type==="UnaryExpression"&&(e.operator==="+"||e.operator==="-")&&m(e.argument).type==="Literal"}function BS(e,t){let r=e.type==="Literal"?e.raw[0]:"'";return s=>s.replaceText(e,pt(t.toLowerCase(),r))}function*HS(e,t,r){if(e===null){yield{node:t,messageId:Rc};return}if(e.type==="SpreadElement")return;let s=GS(e);if(!s){Nc(e)&&(yield{node:e,messageId:Oc});return}if(s.value===""){yield{node:s.node,messageId:jc};return}let n=s.value.toLowerCase();if(NS.test(s.value)){yield{node:s.node,messageId:Mc,data:{tag:s.value}};return}if(FS.has(n)){yield{node:s.node,messageId:Dc,data:{tag:s.value}};return}if(s.value!==n&&(yield{node:s.node,messageId:Pc,data:{tag:s.value},fix:BS(s.node,s.value)}),r.has(n)){yield{node:s.node,messageId:_c,data:{tag:n}};return}r.add(n)}var qS=e=>{let t=d(e);if(!t.isTestFile)return;let r=y(t);e.on("CallExpression",function*(s){let n=r.isSubtestCall(s);r.update(s);let o=b(s,t);if(!n&&o?.kind!=="test"&&o?.kind!=="suite"||o?.modifiers.length>1||o?.modifiers.some(l=>!_S.has(l.name)))return;let i=W(F(s),"tags");if(i?.kind!=="init")return;let a=m(i.value);if(a.type!=="ArrayExpression"){Nc(a)&&(yield{node:a,messageId:Ac});return}let c=new Set;for(let l of a.elements)yield*HS(l,a,c)}),e.onExit("CallExpression",s=>{r.leave(s)})},US={create:qS,meta:{type:"problem",docs:{description:"Require valid test tags.",recommended:"unopinionated"},fixable:"code",schema:[],messages:LS,languages:["js/js"]}},Fc=US;import WS from"node:path";var jt={name:"eslint-node-test",version:"1.0.1",description:"ESLint rules for the Node.js built-in test runner (`node:test`)",license:"MIT",repository:"sindresorhus/eslint-node-test",funding:"https://github.com/sindresorhus/eslint-node-test?sponsor=1",author:{name:"Sindre Sorhus",email:"sindresorhus@gmail.com",url:"https://sindresorhus.com"},type:"module",exports:{types:"./index.d.ts",default:"./index.js"},sideEffects:!1,engines:{node:">=22"},scripts:{coverage:"node --test --experimental-test-coverage test/*.js test/unit/*.js","create-rule":"node ./scripts/create-rule.js && npm run create-rules-index-file && npm run fix:eslint-docs","create-rules-index-file":"node ./scripts/create-rules-index-file.js",fix:'run-p --continue-on-error "fix:*"',"fix:eslint-docs":"eslint-doc-generator","fix:js":"npm run lint:js -- --fix","fix:markdown":"npm run lint:markdown -- --fix","fix:snapshots":"node --test --test-update-snapshots test/*.js test/unit/*.js",lint:'run-p --continue-on-error "lint:*"',"lint:dogfooding":"eslint --config=./eslint.dogfooding.config.js","lint:eslint-docs":"npm run fix:eslint-docs -- --check","lint:js":"eslint","lint:markdown":'markdownlint "**/*.md"',"lint:package-json":"npmPkgJsonLint .","rename-rule":"node ./scripts/rename-rule.js && npm run create-rules-index-file && npm run fix:eslint-docs","run-rules-on-codebase":"npm run lint:dogfooding",test:'npm-run-all --node-run --continue-on-error lint "test:*"',"test:js":"node --test test/*.js test/unit/*.js"},files:["index.js","index.d.ts","rules"],keywords:["eslint","eslintplugin","eslint-plugin","node-test","node:test","test-runner","testing","test","linter","lint","style","xo"],dependencies:{"@eslint-community/eslint-utils":"^4.9.1","quote-js-string":"^0.1.0"},devDependencies:{"@babel/code-frame":"^8.0.0","@typescript-eslint/parser":"^8.62.1","@typescript-eslint/types":"^8.62.1",enquirer:"^2.4.1",eslint:"^10.6.0","eslint-config-xo":"^0.56.0","eslint-doc-generator":"^3.6.0","eslint-plugin-eslint-plugin":"^7.4.1","eslint-plugin-jsdoc":"^63.0.10","eslint-scope":"^9.1.2",espree:"^11.2.0",globals:"^17.7.0","indent-string":"^5.0.0","markdownlint-cli":"^0.49.0","nano-spawn":"^2.1.0","npm-package-json-lint":"^10.4.1","npm-run-all2":"^9.0.2","open-editor":"^6.0.0",outdent:"^0.8.0",typescript:"^6.0.3","vue-eslint-parser":"^10.4.1",yaml:"^2.9.0"},peerDependencies:{eslint:">=10.4"}};var $S="https://github.com/sindresorhus/eslint-node-test";function Dr(e){let t=WS.basename(e,".js");return`${$S}/blob/v${jt.version}/docs/rules/${t}.md`}import XS from"node:assert/strict";function _r(e,t){return new Proxy(e,{get(s,n,o){return n==="on"||n==="onExit"?t[n].bind(t):Reflect.get(s,n,o)}})}var KS=e=>typeof e?.[Symbol.iterator]=="function";function*ft(e){if(!KS(e)){yield e;return}for(let t of e)yield*ft(t)}var Pt=class extends Error{name="FixAbortError"},zS={abort(){throw new Pt("Fix aborted.")}};function Mt(e){return t=>{try{let r=e(t,zS);return[...ft(r)].filter(Boolean)}catch(r){if(r instanceof Pt)return;throw r}}}function Nr(e){let t={...e};return e.fix&&(t.fix=Mt(e.fix)),e.suggest&&(t.suggest=[...ft(e.suggest)].filter(r=>typeof r.fix=="function").map(r=>({...r,fix:Mt(r.fix),data:{...e.data,...r.data}}))),t}function Fr(e,t){if(t){if(typeof t[Symbol.iterator]!="function"||"node"in t){e.report(Nr(t));return}for(let r of t)Fr(e,r)}}function Lr(e,t){if(t.length===1){let[r]=t;return(s,n,o)=>{let i=r(s,n,o);i!==void 0&&Fr(e,i)}}return(r,s,n)=>{for(let o of t){let i=o(r,s,n);i!==void 0&&Fr(e,i)}}}var mt=class{#e;#t=new Map;constructor(t){this.#e=t}#r(t,r){let s=this.#t;for(let n of t)s.has(n)?s.get(n).push(r):s.set(n,[r])}on(t,r){let s=Array.isArray(t)?t:[t];this.#r(s,r)}onExit(t,r){let s=Array.isArray(t)?t:[t];this.#r(s.map(n=>`${n}:exit`),r)}toEslintListeners(){let t={};for(let[r,s]of this.#t)t[r]=Lr(this.#e,s);return t}};function Gr(e){return t=>{let r=new mt(t),s=_r(t,r),n=e(s);return XS.equal(n,void 0,`[${t.id}] Rule \`create\` function should return \`undefined\`, please use \`context.on()\` instead of return listeners.`),r.toEslintListeners()}}function Br(e,t){return{meta:{schema:[],...t.meta,docs:{...t.meta.docs,url:Dr(e)}},create:Gr(t.create)}}function Dt(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,Br(t,r)]))}var Lc=Dt(Mr),qr=e=>Object.fromEntries(Object.entries(Lc).map(([t,r])=>[`node-test/${t}`,!r.meta.deprecated&&e(r)?"error":"off"])),YS=qr(e=>!!e.meta.docs.recommended),JS=qr(e=>e.meta.docs.recommended==="unopinionated"),QS=qr(()=>!0),Hr=(e,t)=>({name:t,plugins:{"node-test":Ur},rules:e}),Ur={meta:{name:"node-test",version:jt.version},rules:Lc},ZS={recommended:Hr(YS,"node-test/recommended"),unopinionated:Hr(JS,"node-test/unopinionated"),all:Hr(QS,"node-test/all")};Ur.configs=ZS;var Vr=Ur;var eb=Object.fromEntries(["no-assert-throws-async","no-assert-throws-multiple-statements","no-callback-and-promise","no-duplicate-mock-timers-enable","no-late-test-activity","no-mock-timers-destructured-import","no-unneeded-async-rejects-callback","no-useless-assertion"].map(e=>{if(!Vr.rules[e])throw new Error("Missing upstream rule: "+e);return[e,Vr.rules[e]]})),NO={meta:{name:"eslint-node-test",version:"1.0.1"},rules:eb};export{NO as default};