karma-runner / karma-runner/karma

karma stop when error object is not string (Firefox & IE)

Open
#1,750 0 comments 0 reactions 0 assignees View on GitHub
needs: investigation
Dominant language
JavaScript
Stars
12k
Forks
1.7k
PR merge metrics
No merged PRs in 30d

Description

I started a test with Karma and received the error `TypeError: undefined is not a function`. I tried to debug it and found out that: in the function `createErrorFormatter` in the file `reporter.js` this line couldn't be executed:
`msg = (msg || '').replace(URL_REGEXP, function (_, prefix, path, __, ___, line, ____, column) {...`

The reason is the `msg` which was given in the method `onKarmaError` in the file `browser.js` is not a `String` and hence the `replace` function is `undefined`:

Surprisingly this issue occurs only when I test with Firefox and IE. There is no issue with Chrome and Safari.

![karma1](https://cloud.githubusercontent.com/assets/1616729/11626680/f9fdf022-9ce4-11e5-9219-b1eab2617b20.jpg)

![karma2](https://cloud.githubusercontent.com/assets/1616729/11626688/02ef7372-9ce5-11e5-90dd-94930b2881ae.jpg)

Contributor guide

Open the contributing guide

Research direction

Start in reporter.js at createErrorFormatter and trace the message passed from browser.js through onKarmaError. Reproduce the failure in Firefox or IE with a non-string error object, then verify that error formatting completes without the replace call failing.

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
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.