question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ReferenceError in test-script

See original GitHub issue

All tests fail with two ReferenceError in test-script via newman. Tests are ok throught postman UI.

  1. Newman Version: 3.9.2
  2. OS details (type, version, and architecture): Windows 10- 64 bits
  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: I’m new to newman
  5. Expected behaviour: All tests shouls succeed
  6. Command / script used to run Newman: NODE_DEBUG=request newman run https://api.getpostman.com/collections/340554-d362e66e-d68e-4445-e304-ff59fc652160?apikey=myApiKey \ --environment /c/var/myEnvironement.json \ --folder download \ --iteration-data ./CI/postman_data_files/download.csv \ --color
  7. Sample collection, and auxiliary files (minus the sensitive details):
  8. Screenshots (if applicable):

Output logs:

Iteration 1/28

□ download
└ Get one export JSON
  GET http://localhost:8080/exports/normal/INTERVIEWS_STATS/JSON REQUEST { headers:
   { 'SA-requested-room': 'brand1.superlocal.com',
     Authorization: 'Bearer 00c39dcf-ed6f-4625-b443-9deb6c8d9d28',
     'User-Agent': 'PostmanRuntime/7.1.3',
     Accept: '*/*',
     Host: 'localhost:8080' },
  url: 'http://localhost:8080/exports/normal/INTERVIEWS_STATS/JSON',
  method: 'GET',
  jar:
   RequestJar {
     _jar: CookieJar { enableLooseMode: true, store: { idx: {} } } },
  gzip: true,
  useQuerystring: true,
  followRedirect: true,
  followAllRedirects: true,
  encoding: null,
  lookup: [Function: bound lookup],
  agentOptions: { keepAlive: true },
  callback: [Function] }
REQUEST make request http://localhost:8080/exports/normal/INTERVIEWS_STATS/JSON
REQUEST onRequestResponse http://localhost:8080/exports/normal/INTERVIEWS_STATS/JSON 200 { 'content-encoding': 'gzip',
  connection: 'keep-alive',
  'cache-control': 'no-cache, must-revalidate, no-transform',
  'x-powered-by': 'Undertow/1',
  server: 'WildFly/8',
  'content-type': 'application/json;charset=UTF-8',
  'content-length': '3015',
  date: 'Fri, 12 Jan 2018 14:55:08 GMT' }
REQUEST reading response's body
REQUEST finish init function http://localhost:8080/exports/normal/INTERVIEWS_STATS/JSON
REQUEST response end http://localhost:8080/exports/normal/INTERVIEWS_STATS/JSON 200 { 'content-encoding': 'gzip',
  connection: 'keep-alive',
  'cache-control': 'no-cache, must-revalidate, no-transform',
  'x-powered-by': 'Undertow/1',
  server: 'WildFly/8',
  'content-type': 'application/json;charset=UTF-8',
  'content-length': '3015',
  date: 'Fri, 12 Jan 2018 14:55:08 GMT' }
REQUEST end event http://localhost:8080/exports/normal/INTERVIEWS_STATS/JSON
REQUEST has body http://localhost:8080/exports/normal/INTERVIEWS_STATS/JSON 5940
REQUEST emitting complete http://localhost:8080/exports/normal/INTERVIEWS_STATS/JSON
[200 OK, 3.21KB, 2.4s]
  1⠄ ReferenceError in test-script
  2⠄ ReferenceError in test-script

└ Get one export CSV
  GET http://localhost:8080/exports/normal/INTERVIEWS_STATS/CSV REQUEST { headers:
   { 'SA-requested-room': 'brand1.superlocal.com',
     Authorization: 'Bearer 00c39dcf-ed6f-4625-b443-9deb6c8d9d28',
     'User-Agent': 'PostmanRuntime/7.1.3',
     Accept: '*/*',
     Host: 'localhost:8080' },
  url: 'http://localhost:8080/exports/normal/INTERVIEWS_STATS/CSV',
  method: 'GET',
  jar:
   RequestJar {
     _jar: CookieJar { enableLooseMode: true, store: { idx: {} } } },
  gzip: true,
  useQuerystring: true,
  followRedirect: true,
  followAllRedirects: true,
  encoding: null,
  lookup: [Function: bound lookup],
  agentOptions: { keepAlive: true },
  callback: [Function] }
REQUEST make request http://localhost:8080/exports/normal/INTERVIEWS_STATS/CSV
REQUEST onRequestResponse http://localhost:8080/exports/normal/INTERVIEWS_STATS/CSV 200 { 'content-encoding': 'gzip',
  connection: 'keep-alive',
  'cache-control': 'no-cache, must-revalidate, no-transform',
  'x-powered-by': 'Undertow/1',
  server: 'WildFly/8',
  'content-type': 'application/json;charset=UTF-8',
  'content-length': '206',
  date: 'Fri, 12 Jan 2018 14:55:10 GMT' }
REQUEST reading response's body
REQUEST finish init function http://localhost:8080/exports/normal/INTERVIEWS_STATS/CSV
REQUEST response end http://localhost:8080/exports/normal/INTERVIEWS_STATS/CSV 200 { 'content-encoding': 'gzip',
  connection: 'keep-alive',
  'cache-control': 'no-cache, must-revalidate, no-transform',
  'x-powered-by': 'Undertow/1',
  server: 'WildFly/8',
  'content-type': 'application/json;charset=UTF-8',
  'content-length': '206',
  date: 'Fri, 12 Jan 2018 14:55:10 GMT' }
REQUEST end event http://localhost:8080/exports/normal/INTERVIEWS_STATS/CSV
REQUEST has body http://localhost:8080/exports/normal/INTERVIEWS_STATS/CSV 203
REQUEST emitting complete http://localhost:8080/exports/normal/INTERVIEWS_STATS/CSV
[200 OK, 478B, 2.5s]
  3⠄ ReferenceError in test-script
  4⠄ ReferenceError in test-script

└ Get one export XLSX
  GET http://localhost:8080/exports/normal/INTERVIEWS_STATS/CSV REQUEST { headers:
   { 'SA-requested-room': 'brand1.superlocal.com',
     Authorization: 'Bearer 00c39dcf-ed6f-4625-b443-9deb6c8d9d28',
     'User-Agent': 'PostmanRuntime/7.1.3',
     Accept: '*/*',
     Host: 'localhost:8080' },
  url: 'http://localhost:8080/exports/normal/INTERVIEWS_STATS/CSV',
  method: 'GET',
  jar:
   RequestJar {
     _jar: CookieJar { enableLooseMode: true, store: { idx: {} } } },
  gzip: true,
  useQuerystring: true,
  followRedirect: true,
  followAllRedirects: true,
  encoding: null,
  lookup: [Function: bound lookup],
  agentOptions: { keepAlive: true },
  callback: [Function] }
REQUEST make request http://localhost:8080/exports/normal/INTERVIEWS_STATS/CSV
REQUEST onRequestResponse http://localhost:8080/exports/normal/INTERVIEWS_STATS/CSV 200 { 'content-encoding': 'gzip',
  connection: 'keep-alive',
  'cache-control': 'no-cache, must-revalidate, no-transform',
  'x-powered-by': 'Undertow/1',
  server: 'WildFly/8',
  'content-type': 'application/json;charset=UTF-8',
  'content-length': '204',
  date: 'Fri, 12 Jan 2018 14:55:13 GMT' }
REQUEST reading response's body
REQUEST finish init function http://localhost:8080/exports/normal/INTERVIEWS_STATS/CSV
REQUEST response end http://localhost:8080/exports/normal/INTERVIEWS_STATS/CSV 200 { 'content-encoding': 'gzip',
  connection: 'keep-alive',
  'cache-control': 'no-cache, must-revalidate, no-transform',
  'x-powered-by': 'Undertow/1',
  server: 'WildFly/8',
  'content-type': 'application/json;charset=UTF-8',
  'content-length': '204',
  date: 'Fri, 12 Jan 2018 14:55:13 GMT' }
REQUEST end event http://localhost:8080/exports/normal/INTERVIEWS_STATS/CSV
REQUEST has body http://localhost:8080/exports/normal/INTERVIEWS_STATS/CSV 203
REQUEST emitting complete http://localhost:8080/exports/normal/INTERVIEWS_STATS/CSV
[200 OK, 476B, 2.4s]
  5⠄ ReferenceError in test-script
  6⠄ ReferenceError in test-script

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
kunagpalcommented, Jan 29, 2018

@BancarelValentin Closing issue due to inactivity. Feel free to reopen if you’re facing issues. 😄

1reaction
kunagpalcommented, Jan 12, 2018

Okay, it looks like you’re using postman-bdd to organize your tests. While globals are automatically picked up by the Postman app, Newman requires explicitly passing a file of global variables via the -g /path/to/globals/file.json flag. You can do this by exporting globals from the app, and passing the path to the exported file via -g to newman run.

Additionally, you’d also want to check out the all new pm.test interface, which has been documented here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

"ReferenceError in test-script" while running newman #595
I have a postman collection which runs fine from postman. In the script, i have some tests that do some basic validations on...
Read more >
How To Fix Common Errors In Postman
Sometimes we get the error “ReferenceError: jsonData is not defined” while setting the global variable. To fix this, we need to define jsonData ......
Read more >
Why do I get "ReferenceError: test is not defined"
Within my Google Script Project I got two GS files Code.gs and other.gs . code.gs looks like var globalSettings = {}; settings(); function ......
Read more >
ReferenceError: "x" is not defined - JavaScript - MDN Web Docs
The JavaScript exception "variable is not defined" occurs when there is a non-existent variable referenced somewhere.
Read more >
jQuery - Validation Test Suite - Willet Law Office
ReferenceError: $ is not defined at Object.<anonymous> (https://willetlaw.com/include/scripts/jquery-validation-master/test/rules.js:4:16) ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found