Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
brabenetz opened this issue Nov 10, 2021 · 1 comment
Open

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

brabenetz opened this issue Nov 10, 2021 · 1 comment

Comments

@brabenetz
Copy link

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'],
        ....
        });
}
@chivekrodis
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants