karma-runner / karma-runner/karma

browserConsoleLogOptions.filter doesn't work

Open
#3,429 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
12k
Forks
1.7k
PR merge metrics
No merged PRs in 30d

Description

### Expected behaviour

The config option `browserConsoleLogOptions.filter` should configure how log messages are displayed.

### Actual behaviour

Karma seems to ignore this config option.

### Environment Details

- Karma version (output of `karma --version`): 4.4.1
- Relevant part of your `karma.config.js` file

```js
browserConsoleLogOptions: {
format: "-test- %T: %m",
},
```

### Steps to reproduce the behaviour

1. Add the included code snippet to your karma.config.js
2. Put a `console.log` statement in one of your tests; eg `console.log("hi")`
3. Run `karma start`
4. Observe that `LOG: 'hi'` is printed, instead of `-test- LOG: 'hi'`

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with the shown browserConsoleLogOptions configuration in karma.config.js, a console.log("hi") in a test, and karma start. Trace how the option is read and how browser log output is produced; done means the output uses the configured "-test- %T: %m" format instead of the default prefix.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
testing
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.