@@ -14,13 +14,15 @@ describe('pipe()', () => {
14
14
15
15
it ( 'should show the function name in the Command Log' , ( done ) => {
16
16
const getFoo = subject => subject . foo
17
+ const timeout = setTimeout ( ( ) => { done ( new Error ( 'Timed out waiting for log' ) ) } , 1000 )
17
18
cy . on ( 'log:added' , ( attrs , log ) => {
18
19
if ( log . get ( 'name' ) === 'pipe' ) {
19
20
cy . removeAllListeners ( 'log:added' )
20
21
21
22
expect ( log . get ( 'message' ) ) . to . eq ( 'getFoo' )
22
23
expect ( log . get ( 'name' ) ) . to . eq ( 'pipe' )
23
24
expect ( log . invoke ( 'consoleProps' ) ) . to . have . property ( 'Command' , 'pipe' )
25
+ clearTimeout ( timeout )
24
26
done ( )
25
27
}
26
28
} )
@@ -33,7 +35,7 @@ describe('pipe()', () => {
33
35
const obj = { foo : 'bar' }
34
36
setTimeout ( ( ) => { obj . foo = 'baz' } , delay )
35
37
cy . wrap ( obj )
36
- . pipe ( subject => subject . foo )
38
+ . pipe ( subject => subject . foo )
37
39
. should ( 'equal' , 'baz' )
38
40
} )
39
41
@@ -146,13 +148,15 @@ describe('pipe()', () => {
146
148
147
149
it ( 'should show the function name in the Command Log' , ( done ) => {
148
150
const getFoo = subject => cy . wrap ( subject . foo )
151
+ const timeout = setTimeout ( ( ) => { done ( new Error ( 'Timed out waiting for log' ) ) } , 1000 )
149
152
cy . on ( 'log:added' , ( attrs , log ) => {
150
153
if ( log . get ( 'name' ) === 'pipe' ) {
151
154
cy . removeAllListeners ( 'log:added' )
152
155
153
156
expect ( log . get ( 'message' ) ) . to . eq ( 'getFoo' )
154
157
expect ( log . get ( 'name' ) ) . to . eq ( 'pipe' )
155
158
expect ( log . invoke ( 'consoleProps' ) ) . to . have . property ( 'Command' , 'pipe' )
159
+ clearTimeout ( timeout )
156
160
done ( )
157
161
}
158
162
} )
0 commit comments