Search code examples
postmannode-modulesnewman

How to set setTimeout/Thread.sleep in newman


How to set setTimeout/Thread.sleep in newman(postman's node module).

I am using below function :

setTimeout(function(){ 

        console.log('sleep for ten min');
    }, 600000);

Above function works perfectly in collection runner of postman.

But when I tried newman it is throwing error as

'setTimeout is not available inside sandbox and has no side-effect.'

I have found a similar thread like below:

https://github.com/postmanlabs/newman/issues/304

But they also haven't provided any solution.

Is there anyway by which I can mark my single API to delay for a time period.

I am already using Newman parameter --delay-request 60000 which delay between API's so it won't work for it.

enter image description here

Any solution will be helpful


Solution

  • Update newman to 3.8.3 or later.

    The older version of newman is not supporting setTimeout