Cannot read property 'promiseFinish' of undefined
Closed this issue · 5 comments
guiyomh commented
Sometimes, I have this error
at /builds/apps/my-project/node_modules/@reportportal/client-javascript/lib/report-portal-client.js:516:69
at Array.map (<anonymous>)
at RPClient.finishTestItem (/builds/apps/my-project/node_modules/@reportportal/client-javascript/lib/report-portal-client.js:516:38)
at EventEmitter.<anonymous> (/builds/apps/my-project/node_modules/@reportportal/agent-js-codecept/index.js:233:16)
at EventEmitter.emit (events.js:326:22)
at EventEmitter.emit (domain.js:486:12)
at Object.emit (/builds/apps/my-project/node_modules/codeceptjs/lib/event.js:143:28)
at done (/builds/apps/my-project/node_modules/codeceptjs/lib/codecept.js:164:15)
at /builds/apps/my-project/node_modules/codeceptjs/lib/codecept.js:171:25
at done (/builds/apps/my-project/node_modules/mocha/lib/mocha.js:843:7)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:10) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:10) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
it's random, as if the promise does not exist.
AmsterGet commented
Hi @guiyomh !
This error seems to be thrown when the agent tries to finish a non-existent item or an already finished item.
It looks like it depends on the @reportportal/agent-js-codecept
agent's work.
guiyomh commented
@AmsterGet, Yes, the error comes at the end of all the tests to finish the launch. So in the UI, I have to do a force finish.
ematta commented
Is there any update on this error? I'm experiencing it with the jest agent as well.
jakoviktor commented
Hi @AmsterGet
A simple undefined check in the finishTestItem
method solved this problem for me
itemObj.childrens.map(itemId => this.map[itemId] && this.map[itemId].promiseFinish)