I am trying to use some of the features of Node to get some context around my running tests. Specifically I am attempting to retrieve the current directory so that I can troubleshoot failures when attempting to use external packages.
My research directed me to cwd method of the process object - https://nodejs.org/api/process.html#process_process_cwd. I have attempted to call this method from the Pre-request Script tab of my Postman environment but it immediately fails with this error:
ReferenceError: process is not defined
I am new to node and am trying here but from what I’ve read there is no need to specifically require the process object in the script and that anything that is core to Node is accessible.
Things I have tried to resolve this:
- Have a specific require call to process. This generates the same error
- Uninstalled and reinstalled postman
- Installed Node separately apart from Postman. This is also to support command line execution via Newman
None of the above have resolved the issue. Extensive googling and perusing of this community has shed zero light on this.
Is accessing node objects not a feature of Postman?
Am I doing something wrong?
Any insight would be greatly appreciated.