File tree Expand file tree Collapse file tree 4 files changed +13
-29
lines changed Expand file tree Collapse file tree 4 files changed +13
-29
lines changed Original file line number Diff line number Diff line change 11/// <reference types="node"/>
22
3- export interface ObservableLike {
4- subscribe ( observer : ( value : unknown ) => void ) : void ;
5- [ Symbol . observable ] ( ) : ObservableLike ;
3+ export interface Subscribable {
4+ subscribe ( observer : {
5+ error ( err : any ) : void ,
6+ complete ( ) : void ,
7+ } ) : void
68}
79
810export type Constructor = ( new ( ...args : Array < any > ) => any ) ;
@@ -472,7 +474,7 @@ export interface CbExecutionContext<Context = unknown> extends ExecutionContext<
472474 end ( error ?: any ) : void ;
473475}
474476
475- export type ImplementationResult = PromiseLike < void > | ObservableLike | void ;
477+ export type ImplementationResult = PromiseLike < void > | Subscribable | void ;
476478export type Implementation < Context = unknown > = ( t : ExecutionContext < Context > ) => ImplementationResult ;
477479export type CbImplementation < Context = unknown > = ( t : CbExecutionContext < Context > ) => ImplementationResult ;
478480
Original file line number Diff line number Diff line change 11'use strict' ;
22const concordance = require ( 'concordance' ) ;
3- const observableToPromise = require ( 'observable-to-promise' ) ;
43const isPromise = require ( 'is-promise' ) ;
5- const isObservable = require ( 'is-observable' ) ;
64const plur = require ( 'plur' ) ;
75const assert = require ( './assert' ) ;
86const nowAndTimers = require ( './now-and-timers' ) ;
@@ -577,12 +575,17 @@ class Test {
577575 return this . finishPromised ( ) ;
578576 }
579577
580- const returnedObservable = isObservable ( result . retval ) ;
578+ const returnedObservable = result . retval !== null && typeof result . retval === 'object' && typeof result . retval . subscribe === 'function' ;
581579 const returnedPromise = isPromise ( result . retval ) ;
582580
583581 let promise ;
584582 if ( returnedObservable ) {
585- promise = observableToPromise ( result . retval ) ;
583+ promise = new Promise ( ( resolve , reject ) => {
584+ result . retval . subscribe ( {
585+ error : reject ,
586+ complete : ( ) => resolve ( )
587+ } ) ;
588+ } ) ;
586589 } else if ( returnedPromise ) {
587590 // `retval` can be any thenable, so convert to a proper promise.
588591 promise = Promise . resolve ( result . retval ) ;
Original file line number Diff line number Diff line change 8585 "indent-string" : " ^4.0.0" ,
8686 "is-ci" : " ^2.0.0" ,
8787 "is-error" : " ^2.2.2" ,
88- "is-observable" : " ^2.0.0" ,
8988 "is-plain-object" : " ^3.0.0" ,
9089 "is-promise" : " ^2.1.0" ,
9190 "lodash" : " ^4.17.15" ,
9291 "matcher" : " ^2.1.0" ,
9392 "md5-hex" : " ^3.0.1" ,
9493 "micromatch" : " ^4.0.2" ,
9594 "ms" : " ^2.1.2" ,
96- "observable-to-promise" : " ^1.0.0" ,
9795 "ora" : " ^4.0.3" ,
9896 "p-map" : " ^3.0.0" ,
9997 "pkg-conf" : " ^3.1.0" ,
You can’t perform that action at this time.
0 commit comments