This is where I define my functions and export them using module.exports
class GITHelper extends Helper {
addLatestReport(){
simpleGitPromise.addRemote(date,remote);
return simpleGitPromise.add('.')
.then(
(addSuccess) => {
console.log(addSuccess);
}, (failedAdd) => {
console.log('adding files failed');
});
}
commitLatestReport(){
console.log("Committing...");
return simpleGit.commit("Latest output from Automated UI Testing", "./output");
}
pushLatestReport() {
console.log('Pushing...');
return simpleGit.push(remote);
}
}
module.exports = GITHelper;
I require this module in another node dependency file (mochawesome) using this
var gitHelper = require('../../../helpers/GITHelper.js');
and then I call the functions like so:
async function gitSender()
{
await gitHelper.addLatestReport();
await gitHelper.commitLatestReport();
await gitHelper.pushlatestReport();
console.log("Upload completed");
}
"TypeError: gitHelper.addLatestReport is not a function"
Are these not defined functions? Are they not being exported correctly?