File tree Expand file tree Collapse file tree 1 file changed +16
-6
lines changed
Expand file tree Collapse file tree 1 file changed +16
-6
lines changed Original file line number Diff line number Diff line change 55
66'use strict'
77
8+ const assertionCommands = [
9+ // assertions
10+ 'should' ,
11+ 'and' ,
12+ 'contains' ,
13+
14+ // not an assertion, but unlikely to require waiting for render
15+ 'scrollIntoView' ,
16+ 'scrollTo' ,
17+ ] ;
18+
819module . exports = {
920 meta : {
1021 docs : {
@@ -30,11 +41,11 @@ module.exports = {
3041
3142function isRootCypress ( node ) {
3243 while ( node . type === 'CallExpression' ) {
33- if ( node . callee . type === 'MemberExpression' &&
34- node . callee . object . type === 'Identifier' &&
44+ if ( node . callee . type !== 'MemberExpression' ) return false
45+ if ( node . callee . object . type === 'Identifier' &&
3546 node . callee . object . name === 'cy' ) {
36- return true
37- }
47+ return true
48+ }
3849 node = node . callee . object
3950 }
4051 return false
@@ -92,6 +103,5 @@ function getPreviousCypressCommand(node) {
92103
93104function isPreviousAnAssertion ( node ) {
94105 const previousCypressCommand = getPreviousCypressCommand ( node )
95- return previousCypressCommand === 'get' ||
96- previousCypressCommand === 'should'
106+ return assertionCommands . indexOf ( previousCypressCommand ) >= 0
97107}
You can’t perform that action at this time.
0 commit comments