client-javascript
client-javascript copied to clipboard
Agent for Angular Karma Tests - Is there somewhere an Example?
I tried agent-js-jasmine and also looked into the issues:
- https://github.com/reportportal/agent-js-jasmine/issues/2
- https://github.com/reportportal/agent-js-jasmine/issues/39
But sadly I have no clue how that should work:
- onPrepare() and afterLaunch() in karma.conf.js is never called
I tried creating a karma plugin, but I have no clue where I can get the jasmine instance:
var ReportServerReporter = function (baseReporterDecorator, config) {
console.log('#### ReportServerReporter ####');
this.onRunStart = function (browsers) {
console.log('#### onRunStart ####: ', browsers);
// no idea how to get the jasmine object
// jasmine.getEnv().addReporter(agent.getJasmineReporter());
}
this.onBrowserComplete = function (browsers) {
console.log('#### onBrowserComplete ####: ', browsers);
}
this.onExit = function (done) {
console.log('#### onExit ####');
done();
}
};
ReportServerReporter.$inject = ['baseReporterDecorator', 'config'];
module.exports = function (config) {
config.set({
....
plugins: [
...,
{ 'reporter:report-server': ['type', ReportServerReporter] }
],
....
reporters: [...., 'report-server'],
....
});
}
Hello @brabenetz Unfortunately, cannot help with it.
module.exports = function (config) {
console.log(window.jasmine); // Seems it should be in global object here, but it is not.
}
Here is an issue in karma-jasmine repo. Perhaps there will be some updates.