packageDocumentation import currentActionContext from './currentActionContext' ; import { isPendingError } from './PendingError' ; import { getInstance } from './singleton' ; import { ActionFunction , StepDefName } from './types' ; export { isPendingError } from './PendingError' ; export { StepName } from './StepName' ; export { ActionFunction , ActionWrapper , IConfig , IStep , ITestExecutionContext , ITestReporter , StepDefName , Thenable } from './types' ; public export function test < X > ( name , f ) ; public export function test ( nameParts , ... substitutions ) ; export function test ( ... args ) { return getInstance ( ) . test ( ... args ) ; } public export function to < X > ( name , f ) ; public export function to ( nameParts , ... substitutions ) ; export function to ( ... args ) { return getInstance ( ) . to ( ... args ) ; } public export function action ( name , f ) ; public export function action ( nameParts , ... substitutions ) ; public deprecated export function action ( f ) ; export function action ( ... args ) { return getInstance ( ) . action ( ... args ) ; } public export function defer ( name , f ) ; public export function defer ( nameParts , ... substitutions ) ; /**
 * Creates a Deferred Action Step, for, e.g., cleaning up resources.
 */ export function defer ( ... args ) { return getInstance ( ) . defer ( ... args ) ; } public export function pending ( ) { getInstance ( ) . pending ( ) ; } public export function independent < X > ( f ) { return getInstance ( ) . independent ( f ) ; } public deprecated export function step < X > ( name , f ) ; public deprecated export function step ( ... args ) { return getInstance ( ) . step ( ... args ) ; } public deprecated export function cleanup < X > ( name , f ) ; export function cleanup ( ... args ) { return getInstance ( ) . cleanup ( ... args ) ; } public deprecated export function onFinish ( f ) ; export function onFinish ( ... args ) { return getInstance ( ) . onFinish ( ... args ) ; } public export function getCurrentState ( ) { if ( ! currentActionContext . current ) { throw new Error ( 'getCurrentState() must be called inside an action.' ) ; } return currentActionContext . current . state ; } public export function getCurrentContext ( ) { if ( ! currentActionContext . current ) { throw new Error ( 'getCurrentContext() must be called inside an action.' ) ; } return currentActionContext . current . context ; } const stateCache = new WeakMap < any , Prescript . PrescriptionState > ( ) ; public export function getCurrentPrescriptionState ( ) { const instance = getInstance ( ) ; if ( stateCache . has ( instance ) ) return stateCache . get ( instance ) ! ; const state = { } ; stateCache . set ( instance , state ) ; return state ; } export default { test , to , action , defer , pending , step , cleanup , onFinish , getCurrentState , getCurrentContext , getCurrentPrescriptionState , isPendingError } ;