postmanlabs / postman-app-support

Postman is an API platform for building and using APIs. Postman simplifies each step of the API lifecycle and streamlines collaboration so you can create better APIs—faster.
https://www.postman.com
5.82k stars 836 forks source link

Fixing "Using "CryptoJS" is deprecated. Use "require('crypto-js')" instead." console warning results in breaking newman test run #13108

Open avostretsov opened 3 weeks ago

avostretsov commented 3 weeks ago

Is there an existing issue for this?

Describe the Issue

Post V11 release I started seeing various warnings in the Postman app console. This is the last one I am having trouble resolving: Using "CryptoJS" is deprecated. Use "require('crypto-js')" instead.

Steps To Reproduce

  1. Have Postman upgraded to V11+
  2. Use CriptoJs package to decode jwt in the Scripts
  3. Run the test in Postman with console open Notice how Postman console throws the following warning: Using "CryptoJS" is deprecated. Use "require('crypto-js')" instead.
  4. Get the warning silenced by defining CryptoJS const CryptoJS = require('crypto-js')
  5. Re-run the test in Postman app Notice how CriptoJS warning is no longer showing
  6. Run the same Postman collection with newman

Expected Outcome: newman test rune completes without errors

Actual Outcome: newman test run results in the following error: Identifier 'CryptoJS' has already been declared at test-script inside [Call Name]

Screenshots or Videos

No response

Operating System

macOS

Postman Version

11.8.1

Postman Platform

Postman App

User Account Type

Signed In User

Additional Context?

Newman version 6.2.1

sini4242 commented 1 week ago

I met the same issue when I running postman with Newman command

appurva21 commented 1 week ago

Hi @avostretsov @sini4242, thanks for the report!

This will be fixed with the next release of Newman. Until then, as a workaround, either change your variable name to something else or declare it using the var keyword.