@@ -17,7 +17,7 @@ import type {
1717
1818import { getState , dispatch } from './state' ;
1919import {
20- callAsyncFn ,
20+ callAsyncCircusFn ,
2121 getAllHooksForDescribe ,
2222 getEachHooksForTest ,
2323 getTestID ,
@@ -44,7 +44,7 @@ const _runTestsForDescribeBlock = async (describeBlock: DescribeBlock) => {
4444 const { beforeAll, afterAll} = getAllHooksForDescribe ( describeBlock ) ;
4545
4646 for ( const hook of beforeAll ) {
47- await _callHook ( { describeBlock, hook} ) ;
47+ await _callCircusHook ( { describeBlock, hook} ) ;
4848 }
4949
5050 // Tests that fail and are retried we run after other tests
@@ -77,7 +77,7 @@ const _runTestsForDescribeBlock = async (describeBlock: DescribeBlock) => {
7777 }
7878
7979 for ( const hook of afterAll ) {
80- await _callHook ( { describeBlock, hook} ) ;
80+ await _callCircusHook ( { describeBlock, hook} ) ;
8181 }
8282 dispatch ( { describeBlock, name : 'run_describe_finish' } ) ;
8383} ;
@@ -105,13 +105,13 @@ const _runTest = async (test: TestEntry): Promise<void> => {
105105 // hooks after that.
106106 break ;
107107 }
108- await _callHook ( { hook, test, testContext} ) ;
108+ await _callCircusHook ( { hook, test, testContext} ) ;
109109 }
110110
111- await _callTest ( test , testContext ) ;
111+ await _callCircusTest ( test , testContext ) ;
112112
113113 for ( const hook of afterEach ) {
114- await _callHook ( { hook, test, testContext} ) ;
114+ await _callCircusHook ( { hook, test, testContext} ) ;
115115 }
116116
117117 // `afterAll` hooks should not affect test status (pass or fail), because if
@@ -120,7 +120,7 @@ const _runTest = async (test: TestEntry): Promise<void> => {
120120 dispatch ( { name : 'test_done' , test} ) ;
121121} ;
122122
123- const _callHook = ( {
123+ const _callCircusHook = ( {
124124 hook,
125125 test,
126126 describeBlock,
@@ -133,14 +133,14 @@ const _callHook = ({
133133} ) : Promise < mixed > => {
134134 dispatch ( { hook, name : 'hook_start' } ) ;
135135 const timeout = hook . timeout || getState ( ) . testTimeout ;
136- return callAsyncFn ( hook . fn , testContext , { isHook : true , timeout} )
136+ return callAsyncCircusFn ( hook . fn , testContext , { isHook : true , timeout} )
137137 . then ( ( ) => dispatch ( { describeBlock, hook, name : 'hook_success' , test} ) )
138138 . catch ( error =>
139139 dispatch ( { describeBlock, error, hook, name : 'hook_failure' , test} ) ,
140140 ) ;
141141} ;
142142
143- const _callTest = async (
143+ const _callCircusTest = (
144144 test : TestEntry ,
145145 testContext : TestContext ,
146146) : Promise < void > => {
@@ -150,10 +150,10 @@ const _callTest = async (
150150
151151 if ( test . errors . length ) {
152152 // We don't run the test if there's already an error in before hooks.
153- return;
153+ return Promise . resolve ( ) ;
154154 }
155155
156- await callAsyncFn ( test . fn , testContext , { isHook : false , timeout} )
156+ return callAsyncCircusFn ( test . fn , testContext , { isHook : false , timeout} )
157157 . then ( ( ) => dispatch ( { name : 'test_fn_success' , test} ) )
158158 . catch ( error => dispatch ( { error, name : 'test_fn_failure' , test} ) ) ;
159159} ;
0 commit comments