File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed
Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -95,15 +95,26 @@ const http = require('http');
9595
9696{
9797 // Check pre-cancelled
98- const signal = new EventTarget ( ) ;
99- signal . aborted = true ;
98+ const signal = AbortSignal . abort ( ) ;
10099
101100 const rs = Readable . from ( ( function * ( ) { } ) ( ) ) ;
102101 finished ( rs , { signal } , common . mustCall ( ( err ) => {
103102 assert . strictEqual ( err . name , 'AbortError' ) ;
104103 } ) ) ;
105104}
106105
106+ {
107+ // Check pre-cancelled when eos() must resolve from the signal path.
108+ const signal = AbortSignal . abort ( ) ;
109+
110+ const rs = new Readable ( {
111+ read ( ) { }
112+ } ) ;
113+ finished ( rs , { signal } , common . mustCall ( ( err ) => {
114+ assert . strictEqual ( err . name , 'AbortError' ) ;
115+ } ) ) ;
116+ }
117+
107118{
108119 // Check cancelled before the stream ends sync.
109120 const ac = new AbortController ( ) ;
@@ -160,8 +171,7 @@ const http = require('http');
160171 // Promisified pre-aborted works
161172 const finishedPromise = promisify ( finished ) ;
162173 async function run ( ) {
163- const signal = new EventTarget ( ) ;
164- signal . aborted = true ;
174+ const signal = AbortSignal . abort ( ) ;
165175 const rs = Readable . from ( ( function * ( ) { } ) ( ) ) ;
166176 await finishedPromise ( rs , { signal } ) ;
167177 }
You can’t perform that action at this time.
0 commit comments