postmanlabs / newman

Newman is a command-line collection runner for Postman
https://www.postman.com
Apache License 2.0
6.82k stars 1.15k forks source link

The bail flag does not work with exportGlobals #3170

Open bdlee420 opened 10 months ago

bdlee420 commented 10 months ago

I would expect the exportGlobals function to work even if the bail flag is triggered. Is this a bug? Or expected behavior?

  1. Newman Version (can be found via newman -v): 6.0
  2. OS details (type, version, and architecture): Windows 10 Enterprise
  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: First time trying, so can't confirm if it is new
  5. Expected behaviour: I would expect Globals to be exported even if the BAIL flag is triggered
  6. Command / script used to run Newman:

    var newman = require("{{NewmanPath}}");

newman.run({ insecure: true, bail: true, collection: "C:\some-collection.json", globals: require("C:\globals.json"), exportGlobals: ""C:\globals-export.json"", environment: require("C:\some-environment.json")

Steps to reproduce the problem:

  1. Create a collection
  2. Add request that writes to a Global Variable
  3. Add request that FAILS a test
  4. Run collection with BAIL and EXPORTGLOBALS, and see the global variable is not written