@@ -97,25 +97,9 @@ export const argument = node =>
9797export const argument2 = node =>
9898 node . parent . parent . parent . arguments && node . parent . parent . parent . arguments [ 0 ] ;
9999
100- const describeAliases = new Set ( [
101- 'describe' ,
102- 'describe.only' ,
103- 'describe.skip' ,
104- 'fdescribe' ,
105- 'xdescribe' ,
106- ] ) ;
100+ const describeAliases = new Set ( [ 'describe' , 'fdescribe' , 'xdescribe' ] ) ;
107101
108- export const testCaseNames = new Set ( [
109- 'fit' ,
110- 'it' ,
111- 'it.only' ,
112- 'it.skip' ,
113- 'test' ,
114- 'test.only' ,
115- 'test.skip' ,
116- 'xit' ,
117- 'xtest' ,
118- ] ) ;
102+ const testCaseNames = new Set ( [ 'fit' , 'it' , 'test' , 'xit' , 'xtest' ] ) ;
119103
120104const testHookNames = new Set ( [
121105 'beforeAll' ,
@@ -147,17 +131,25 @@ export const getNodeName = node => {
147131export const isHook = node =>
148132 node &&
149133 node . type === 'CallExpression' &&
150- testHookNames . has ( getNodeName ( node . callee ) ) ;
134+ node . callee . type === 'Identifier' &&
135+ testHookNames . has ( node . callee . name ) ;
151136
152137export const isTestCase = node =>
153138 node &&
154139 node . type === 'CallExpression' &&
155- testCaseNames . has ( getNodeName ( node . callee ) ) ;
140+ ( ( node . callee . type === 'Identifier' && testCaseNames . has ( node . callee . name ) ) ||
141+ ( node . callee . type === 'MemberExpression' &&
142+ node . callee . object . type === 'Identifier' &&
143+ testCaseNames . has ( node . callee . object . name ) ) ) ;
156144
157145export const isDescribe = node =>
158146 node &&
159147 node . type === 'CallExpression' &&
160- describeAliases . has ( getNodeName ( node . callee ) ) ;
148+ ( ( node . callee . type === 'Identifier' &&
149+ describeAliases . has ( node . callee . name ) ) ||
150+ ( node . callee . type === 'MemberExpression' &&
151+ node . callee . object . type === 'Identifier' &&
152+ describeAliases . has ( node . callee . object . name ) ) ) ;
161153
162154export const isFunction = node =>
163155 node &&
0 commit comments