The tests run with Mocha from the command line but when I try to integrate the agent-js-mocha using the API approach, it runs and reports an empty report to my ReportPortal endpoint because there are no tests. I then add the same file pattern I use from the command line and I get errors. Here is my test.js:
`const Mocha = require('mocha');
require('@reportportal/agent-js-mocha');
const mochaMain = new Mocha({
require: 'ts-node/register',
reporter: '@reportportal/agent-js-mocha',
reporterOptions: {
endpoint: 'https://reportportal.xxxx.com/api/v1',
token: 'xxxxxxxxx',
launch: 'HelmsdeepCC-MochaTesting',
project: 'default_personal',
description: 'HelmsdeepCC-MochaTesting'
},
timeout: 250000,
});
// run tests
try {
mochaMain.files = ['tests/*.spec.ts'];
// exit with non-zero exit code, other wise fails will not fail mocha run
mochaMain.run(failures => process.on('exit', () => process.exit(failures)));
} catch (err) {
console.error(Test suite doesn't exists or set. Error: ${err});
}`
And here is the error I am getting:
Test suite doesn't exists or set. Error: Error: Cannot find module '/xxxxx/tests/*.spec.ts'
These tests run from the command line with mocha and all the other options except ReportPortal.
The tests run with Mocha from the command line but when I try to integrate the agent-js-mocha using the API approach, it runs and reports an empty report to my ReportPortal endpoint because there are no tests. I then add the same file pattern I use from the command line and I get errors. Here is my test.js:
`const Mocha = require('mocha');
require('@reportportal/agent-js-mocha');
const mochaMain = new Mocha({
require: 'ts-node/register',
reporter: '@reportportal/agent-js-mocha',
reporterOptions: {
endpoint: 'https://reportportal.xxxx.com/api/v1',
token: 'xxxxxxxxx',
launch: 'HelmsdeepCC-MochaTesting',
project: 'default_personal',
description: 'HelmsdeepCC-MochaTesting'
},
timeout: 250000,
});
// run tests
try {
mochaMain.files = ['tests/*.spec.ts'];
// exit with non-zero exit code, other wise fails will not fail mocha run
mochaMain.run(failures => process.on('exit', () => process.exit(failures)));
} catch (err) {
console.error(Test suite doesn't exists or set. Error: ${err});
}`
And here is the error I am getting:
Test suite doesn't exists or set. Error: Error: Cannot find module '/xxxxx/tests/*.spec.ts'
These tests run from the command line with mocha and all the other options except ReportPortal.