Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Newman error: “identifier has already been declared at test-script” #3294

Open
coreydev42 opened this issue Nov 21, 2024 · 0 comments
Open

Comments

@coreydev42
Copy link

Cross posting with the Postman forum.

I am trying out newman (version 6.2.1) on my local computer using an exported collection and environment. I am running the test on a single folder in my collection.

The test runs but I get the following error for the two requests: Identifier 'responseBody' has already been declared at test-script.

My post-response test script is defined at the collection folder level. At the top of the script I have: const responseBody = pm.response.json(); and I do not redeclare that variable in the script. I only use that variable to run tests such as pm.expect(responseBody)....

I can run these same tests using the Postman CLI and I do not get this error.

This is my first time using newman. What am I missing?

Thanks.

Details:

  1. Newman Version: 6.2.1
  2. OS details (type, version, and architecture): Windows 11, node 20.10.0
  3. Are you using Newman as a library, or via the CLI? CLI
  4. Did you encounter this recently, or has this bug always been there: Recent
  5. Expected behaviour: tests pass
  6. Command / script used to run Newman:
    npx newman run my_collection.json --environment my_environment.json --folder "Invalid Calls"
  7. Sample collection, and auxiliary files (minus the sensitive details): N/A
  8. Screenshots (if applicable): See below

Steps to reproduce:

  1. Create local node development environment with node 20.10.0
  2. Install newman: npm install newman
  3. Export collection and environment to local machine.
  4. Run the command: npx newman run my_collection.json --environment my_environment.json --folder "Invalid Calls"

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant