Error message using report portal

When I try to implement report portal with Codecept I insert this code into the test:

const reportPortal = codeceptjs.container.plugins(‘reportportal’);
reportPortal.addLog({
level: ‘debug’,
message: ‘MAC automation’
});

When I try to run the script, I get this error:

TypeError: Cannot read property ‘addLog’ of undefined
at Object. (/Users/james.francisco/repos/qa-marketing-admin-console/tests/MAC_smoke_test.js:6:16)
at Module._compile (internal/modules/cjs/loader.js:1076:30)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:1097:10)
at Module.load (internal/modules/cjs/loader.js:941:32)
at Function.Module._load (internal/modules/cjs/loader.js:782:14)
at Module.require (internal/modules/cjs/loader.js:965:19)
at require (internal/modules/cjs/helpers.js:88:18)
at /Users/james.francisco/repos/qa-marketing-admin-console/node_modules/codeceptjs/node_modules/mocha/lib/mocha.js:334:36
at Array.forEach ()
at Mocha.loadFiles (/Users/james.francisco/repos/qa-marketing-admin-console/node_modules/codeceptjs/node_modules/mocha/lib/mocha.js:331:14)

TypeError: Cannot read property ‘addLog’ of undefined

Error:
at Codecept.run (/Users/james.francisco/repos/qa-marketing-admin-console/node_modules/codeceptjs/lib/codecept.js:176:13)
at /Users/james.francisco/repos/qa-marketing-admin-console/node_modules/codeceptjs/lib/command/run.js:33:16
at module.exports (/Users/james.francisco/repos/qa-marketing-admin-console/node_modules/codeceptjs/lib/hooks.js:27:13)
at Codecept.runBootstrap (/Users/james.francisco/repos/qa-marketing-admin-console/node_modules/codeceptjs/lib/codecept.js:111:5)
at Command.module.exports (/Users/james.francisco/repos/qa-marketing-admin-console/node_modules/codeceptjs/lib/command/run.js:29:14)
at Command.listener (/Users/james.francisco/repos/qa-marketing-admin-console/node_modules/commander/index.js:315:8)
at Command.emit (events.js:314:20)
at Command.parseArgs (/Users/james.francisco/repos/qa-marketing-admin-console/node_modules/commander/index.js:651:12)
at Command.parse (/Users/james.francisco/repos/qa-marketing-admin-console/node_modules/commander/index.js:474:21)
at Object. (/Users/james.francisco/repos/qa-marketing-admin-console/node_modules/codeceptjs/bin/codecept.js:227:9)

TypeError: Cannot read property ‘addLog’ of undefined

1 Like

I’m curious why don’t you try this https://www.npmjs.com/package/@reportportal/agent-js-codecept

That is what we are using.