@@ -107,6 +107,29 @@ module.exports = {
107107 } ) ;
108108 }
109109
110+ function isModuleHookCallback ( node ) {
111+ return (
112+ node . parent &&
113+ node . parent . type === "Property" &&
114+ utils . isModuleHookPropertyKey ( node . parent . key ) &&
115+ utils . isInModule ( node . parent )
116+ ) ;
117+ }
118+
119+ function pushModuleHookAssert ( node ) {
120+ if ( isModuleHookCallback ( node ) ) {
121+ testStack . push ( {
122+ assertVar : utils . getAssertContextName ( node ) ,
123+ } ) ;
124+ }
125+ }
126+
127+ function popModuleHookAssert ( node ) {
128+ if ( isModuleHookCallback ( node ) ) {
129+ testStack . pop ( ) ;
130+ }
131+ }
132+
110133 return {
111134 CallExpression : function ( node ) {
112135 /* istanbul ignore else: correctly does nothing */
@@ -136,6 +159,15 @@ module.exports = {
136159 testStack . pop ( ) ;
137160 }
138161 } ,
162+
163+ FunctionDeclaration : pushModuleHookAssert ,
164+ FunctionExpression : pushModuleHookAssert ,
165+ ArrowFunctionExpression : pushModuleHookAssert ,
166+
167+ "FunctionDeclaration:exit" : popModuleHookAssert ,
168+ "FunctionExpression:exit" : popModuleHookAssert ,
169+ "ArrowFunctionExpression:exit" : popModuleHookAssert ,
170+
139171 Program : function ( node ) {
140172 // Gather all calls to global `equal()`.
141173 /* istanbul ignore next: deprecated code paths only followed by old eslint versions */
0 commit comments