@@ -45,11 +45,12 @@ const _ = require('lodash'),
4545 * @param {Execution } execution -
4646 * @param {Function } onRequest -
4747 * @param {Function } onAssertion -
48+ * @param {Object } onConnection -
4849 * @param {Object } cookieStore -
4950 * @param {Object } [options] -
5051 * @param {Array.<String> } [options.disabledAPIs] -
5152 */
52- function Postman ( execution , onRequest , onAssertion , cookieStore , options = { } ) {
53+ function Postman ( execution , onRequest , onAssertion , onConnection , cookieStore , options = { } ) {
5354 // @todo - ensure runtime passes data in a scope format
5455 let iterationData = new VariableScope ( ) ;
5556
@@ -167,6 +168,8 @@ function Postman (execution, onRequest, onAssertion, cookieStore, options = {})
167168 */
168169 response : execution . response ,
169170
171+ message : execution . message ,
172+
170173 /**
171174 * The cookies object contains a list of cookies that are associated with the domain
172175 * to which the request was made.
@@ -250,7 +253,9 @@ function Postman (execution, onRequest, onAssertion, cookieStore, options = {})
250253 } ) ;
251254
252255 return self ;
253- }
256+ } ,
257+
258+ connection : onConnection
254259 } , options . disabledAPIs ) ;
255260
256261 // extend pm api with test runner abilities
@@ -265,6 +270,16 @@ function Postman (execution, onRequest, onAssertion, cookieStore, options = {})
265270 }
266271 } ) ;
267272 }
273+
274+ if ( this . message ) {
275+ // these are removed before serializing see `purse.js`
276+ Object . defineProperty ( this . message , 'to' , {
277+ get ( ) {
278+ return chai . expect ( this ) . to ;
279+ }
280+ } ) ;
281+ }
282+
268283 // add request assertions
269284 if ( this . request ) {
270285 // these are removed before serializing see `purse.js`
0 commit comments