@@ -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 for ( const test of describeBlock . tests ) {
5050 await _runTest ( test ) ;
@@ -55,7 +55,7 @@ const _runTestsForDescribeBlock = async (describeBlock: DescribeBlock) => {
5555 }
5656
5757 for ( const hook of afterAll ) {
58- await _callHook ( { describeBlock, hook} ) ;
58+ await _callCircusHook ( { describeBlock, hook} ) ;
5959 }
6060 dispatch ( { describeBlock, name : 'run_describe_finish' } ) ;
6161} ;
@@ -83,13 +83,13 @@ const _runTest = async (test: TestEntry): Promise<void> => {
8383 // hooks after that.
8484 break ;
8585 }
86- await _callHook ( { hook, test, testContext} ) ;
86+ await _callCircusHook ( { hook, test, testContext} ) ;
8787 }
8888
89- await _callTest ( test , testContext ) ;
89+ await _callCircusTest ( test , testContext ) ;
9090
9191 for ( const hook of afterEach ) {
92- await _callHook ( { hook, test, testContext} ) ;
92+ await _callCircusHook ( { hook, test, testContext} ) ;
9393 }
9494
9595 // `afterAll` hooks should not affect test status (pass or fail), because if
@@ -98,7 +98,7 @@ const _runTest = async (test: TestEntry): Promise<void> => {
9898 dispatch ( { name : 'test_done' , test} ) ;
9999} ;
100100
101- const _callHook = ( {
101+ const _callCircusHook = ( {
102102 hook,
103103 test,
104104 describeBlock,
@@ -111,14 +111,14 @@ const _callHook = ({
111111} ) : Promise < mixed > => {
112112 dispatch ( { hook, name : 'hook_start' } ) ;
113113 const timeout = hook . timeout || getState ( ) . testTimeout ;
114- return callAsyncFn ( hook . fn , testContext , { isHook : true , timeout} )
114+ return callAsyncCircusFn ( hook . fn , testContext , { isHook : true , timeout} )
115115 . then ( ( ) => dispatch ( { describeBlock, hook, name : 'hook_success' , test} ) )
116116 . catch ( error =>
117117 dispatch ( { describeBlock, error, hook, name : 'hook_failure' , test} ) ,
118118 ) ;
119119} ;
120120
121- const _callTest = async (
121+ const _callCircusTest = (
122122 test : TestEntry ,
123123 testContext : TestContext ,
124124) : Promise < void > => {
@@ -128,10 +128,10 @@ const _callTest = async (
128128
129129 if ( test . errors . length ) {
130130 // We don't run the test if there's already an error in before hooks.
131- return;
131+ return Promise . resolve ( ) ;
132132 }
133133
134- await callAsyncFn ( test . fn , testContext , { isHook : false , timeout} )
134+ return callAsyncCircusFn ( test . fn , testContext , { isHook : false , timeout} )
135135 . then ( ( ) => dispatch ( { name : 'test_fn_success' , test} ) )
136136 . catch ( error => dispatch ( { error, name : 'test_fn_failure' , test} ) ) ;
137137} ;
0 commit comments