karma icon indicating copy to clipboard operation
karma copied to clipboard

'base' and 'absolute' being replaced in reporter output

Open nicholascelestin opened this issue 9 years ago • 9 comments

Despite the commit in v0.13.11 (b3798df) addressing this, this issue still persists in v0.13.15 .

nicholascelestin avatar Nov 12 '15 21:11 nicholascelestin

Could you provide a repro please?

dignifiedquire avatar Nov 13 '15 09:11 dignifiedquire

I'm seeing this too. I'm using karma-spec-reporter, running this test:

describe('words being replaced', function () {
  it('formats base and absolute unexpectedly in the expectation output only', function () {
    expect('base').toEqual('absolute');
  });
});

The output I'm getting is:

1) formats base and absolute unexpectedly in the expectation output only
      words being replaced
      Expected '/home/michael/proj' to equal ''
     At /home/michael/proj/spec/specExample.js:7

Perhaps https://github.com/karma-runner/karma/blob/master/lib/reporter.js#L25 needs to be more restrictive?

mjgpy3 avatar Nov 16 '15 17:11 mjgpy3

More Info: Suppose I have an expectation written as such:

var result = subject.requestAsJson();
expect(result).toEqual('{ "databaseType": "fredbob" }');

I get output in the console that looks like this:

Expected '{"dataC:/Users/Me/src/ProjectType":"fredbob" }' 
to equal '{ dataC:/Users/Me/src/ProjectType": "foobar" }'.

I'm using jasmine in the context of gulp -> karma -> require -> jasmine.

Here is someone's repro on StackOverflow

crmckenzie avatar Apr 11 '16 20:04 crmckenzie

This problem still exists guys! Is there a plan and timeline to get a fix out? Hinders testing with firebase!

liveakshay avatar Apr 18 '16 17:04 liveakshay

👍

AlaricCalmette avatar Jul 22 '16 12:07 AlaricCalmette

Got this today, it's quite funny but should be fix! :smile:

ValentinH avatar Aug 22 '16 15:08 ValentinH

Just experienced it too. The problem is the same as mentioned above :)

nikolaipetkov avatar May 23 '17 12:05 nikolaipetkov

It seems like URL_REGEXP from https://github.com/karma-runner/karma/blob/master/lib/reporter.js#L22 matches strings like foo absolute bar

vvroman avatar May 06 '21 08:05 vvroman

still alive and kicking 😢

LOG: 'https://api.example.com/base/path/foo'
Chrome Headless 120.0.6099.216 (Mac OS 10.15.7) [...] FAILED
	Expected 'https://api.example.compath/foo' to be 'https://api.example.compath'.

Spec

console.log(fetch.calls.mostRecent().args[0]);

expect(fetch.calls.mostRecent().args[0]).toBe(
  'https://api.example.com/base/path'
);

markus-codewrangler avatar Jan 16 '24 09:01 markus-codewrangler