@@ -107,6 +107,29 @@ module.exports = {
107
107
} ) ;
108
108
}
109
109
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
+
110
133
return {
111
134
CallExpression : function ( node ) {
112
135
/* istanbul ignore else: correctly does nothing */
@@ -136,6 +159,15 @@ module.exports = {
136
159
testStack . pop ( ) ;
137
160
}
138
161
} ,
162
+
163
+ FunctionDeclaration : pushModuleHookAssert ,
164
+ FunctionExpression : pushModuleHookAssert ,
165
+ ArrowFunctionExpression : pushModuleHookAssert ,
166
+
167
+ "FunctionDeclaration:exit" : popModuleHookAssert ,
168
+ "FunctionExpression:exit" : popModuleHookAssert ,
169
+ "ArrowFunctionExpression:exit" : popModuleHookAssert ,
170
+
139
171
Program : function ( node ) {
140
172
// Gather all calls to global `equal()`.
141
173
/* istanbul ignore next: deprecated code paths only followed by old eslint versions */
0 commit comments