Skip to content

initSourcemapReporter causes double logs to the console #9528

Closed

Description

@shairez

Versions

Angular CLI: 1.6.5
Node: 8.9.0
OS: win32 x64
Angular: 5.2.1
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cli: 1.6.5
@angular-devkit/build-optimizer: 0.0.42
@angular-devkit/core: 0.0.29
@angular-devkit/schematics: 0.0.52
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.5
@schematics/angular: 0.1.17
typescript: 2.5.3
webpack: 3.10.0

Repro steps

  • Install karma-mocha-reporter and add it to the plugins array
  • replace progress with mocha in the reporters array in karma.conf.js
  • Add a console.log('TEST') to one of your tests
  • See it being logged twice

(By the way, it also happens with karma-spec-reporter, so it isn't just a mocha-reporter thing)

Observed behavior

Console logs are being logged twice because the initSourcemapReporter inherits from the base reporter which implements the onBrowserLog function by default, so every log the browser emits is being logged by every reporter that doesn't override the write method.

Desired behavior

I want console.logs from test to be displayed only once when reporting using different reporters

Mention any other details that might be useful (optional)

I'm about to submit a PR which fixes this.
Another possible fix is to change the behavior in Karma, but that's out of this repo's scope.

Activity

  1. added a commit that references this issue on Feb 7, 2018
    4412fb8
  2. added 2 commits that reference this issue on Feb 13, 2018
    a161377
    33ff37a
  3. added a commit that references this issue on Apr 23, 2018
    32ffd38
  4. angular-automatic-lock-bot commented on Sep 7, 2019

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  5. locked and limited conversation to collaborators on Sep 7, 2019
  6. added a commit that references this issue on May 29, 2026
    bf6007b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions