Skip to content

Error formatting misleads when URL ends base/ #2209

@mthx

Description

@mthx

Actual behavior

I had a test that ultimately boiled down to the following Jasmine expectation:

expect('http://www.google.com/base/').toEqual('http://www.example.com/base/');

As the failure message, I get:

Expected '' to equal ''

This was quite puzzling and a pain to isolate to karma in my real scenario.

Expected behavior

Clear message as given by Jasmine directly:

Expected 'http://www.google.com/base/' to equal 'http://www.example.com/base/'.

I think this issue relates to the URL_REGEXP in Karma's reporter.js but I haven't dived deep enough to follow what's going on there.

Environment Details

  • Karma version (output of karma --version):

Karma version: 1.1.0

  • Relevant part of your karma.config.js file

Minimal jasmine config.

Steps to reproduce the behaviour

  1. Checkout https://github.com/mthx/karma-error-reporting-issue
  2. npm install
  3. npm run test-jasmine
  4. npm run test-karma
  5. Note the failures from the latter have empty strings as URLs in the error message

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