Search code examples
javascripttestingnativeexternalpostman

I want to use the moment.js (or any other script) in Postman Native App


I know the solution for Postman with Chrome Plugin....

the solution for my Postman with Chrome Plugin is on my mbp I've just add these line also put the moment.min.js (or any javascript file) as path described

<script type="text/javascript" src="../js/tester/moment.min.js"></script>

at the path

~/Library/Application Support/Google/Chrome/Default/Extensions/fhbjgbiflinjbdggehcddcbncdddomop/5.4.0_0/html/

in a file

tester_sandbox.html

for able to use moment in "Tests" or

requester.html

for able to use moment in "Pre-request Script"

but i can't find where the Postman Native App keeps these file path....

i've already try another solution that i found on google about add the script as an GlobalVariable then eval in "Tests" but it's still not work...

any ideas or any recommended ......

thanks


Solution

  • To use moment you need to add this to the top of you pre-request scripts or tests tab

    var moment = require('moment')
    

    Then you can use the module as per the docs.

    moment().add(2, 'days').format()
    

    Or whatever you need...