Skip to content

Agent for Angular Karma Tests - Is there somewhere an Example? #120

Description

@brabenetz

I tried agent-js-jasmine and also looked into the issues:

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'],
        ....
        });
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions