testomatio/reporter

Adjust error if reporter run without url

Closed this issue · 1 comments

Get error if reporter run without main url

"TESTOMATIO_URL=http://localhost:3000"

TESTOMATIO=tstmt_AZ2T4bs4v6elQyRT0Kf8InSVRvV6IO_Kww1716276526 npx newman run collection.json -r testomatio

{
name: 'AssertionError',
index: 2,
test: 'Variable value is updated in pre-request script',
message: "expected undefined to equal 'textVarValue'",
stack: "AssertionError: expected undefined to equal 'textVarValue'\n" +
' at Object.eval sandbox-script.js:3:1)'
}
[TESTOMATIO-NEWMAN-REPORTER] CONSOLE: This is pre-request script
[TESTOMATIO-NEWMAN-REPORTER] CONSOLE: This is pre-request script
[TESTOMATIO-NEWMAN-REPORTER] CONSOLE: Printing environment variable value:
Error: getaddrinfo ENOTFOUND {{url}}
at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:109:26) {
errno: -3008,
code: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: '{{url}}'
}
/Users/vitalikstetsenko/code/examples/newman/node_modules/newman-reporter-testomatio/lib/index.js:95
const responseBodyCut = (0, helpers_1.cutLongText)(((_b = result.response.stream) === null || _b === void 0 ? void 0 : _b.toString()) || '', { maxSizeInKb: 50 });
^

TypeError: Cannot read properties of undefined (reading 'stream')
at EventEmitter. (/Users/vitalikstetsenko/code/examples/newman/node_modules/newman-reporter-testomatio/lib/index.js:95:83)
at EventEmitter.emit (/Users/vitalikstetsenko/code/examples/newman/node_modules/eventemitter3/index.js:203:33)
at Function.callbacks. [as request] (/Users/vitalikstetsenko/code/examples/newman/node_modules/newman/lib/run/index.js:213:34)
at afterRequest (/Users/vitalikstetsenko/code/examples/newman/node_modules/postman-runtime/lib/runner/extensions/http-request.command.js:85:35)
at /Users/vitalikstetsenko/code/examples/newman/node_modules/postman-runtime/lib/runner/extensions/http-request.command.js:169:25
at onEnd (/Users/vitalikstetsenko/code/examples/newman/node_modules/postman-runtime/lib/requester/requester.js:255:24)
at Request._callback (/Users/vitalikstetsenko/code/examples/newman/node_modules/postman-runtime/lib/requester/requester.js:410:24)
at self.callback (/Users/vitalikstetsenko/code/examples/newman/node_modules/postman-request/request.js:311:12)
at Request.emit (node:events:513:28)
at Request.onRequestError (/Users/vitalikstetsenko/code/examples/newman/node_modules/postman-request/request.js:1199:8)
at ClientRequest.emit (node:events:513:28)
at Socket.socketErrorListener (node:_http_client:494:9)
at Socket.emit (node:events:513:28)
at emitErrorNT (node:internal/streams/destroy:157:8)
at emitErrorCloseNT (node:internal/streams/destroy:122:3)
at processTicksAndRejections (node:internal/process/task_queues:83:21)

@Fro0z1k the same error is thrown by Newman and Postman. we can add custom error, but I don't see the reason

and this is just a regular variable which does not differ from variable inside a script; it could have any name, not just url

if you don't agree, please add your argumentation