Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jasmine.anything() does not match anymore #66

Closed
anne-gropler opened this issue Mar 1, 2021 · 4 comments
Closed

jasmine.anything() does not match anymore #66

anne-gropler opened this issue Mar 1, 2021 · 4 comments

Comments

@anne-gropler
Copy link

anne-gropler commented Mar 1, 2021

Hello,
I just updated from jasmine-marbles 0.6.0 to 0.8.1 and now a lot of tests fail like this:

✗ expects to be an Observable (9ms)

	    Expected: a,
	    Received: ?,
	    
	    Expected:

Trying to build a minimal working example that works on 0.6.0 but fails on 0.8.1 got me to the following:

it('minimal working example: some object', () => {
    const provided = cold('a', { a: {someProp: 3} });
    const expected = cold('a', { a: jasmine.anything() });

    expect(provided).toBeObservable(expected);
});

This test fails like this:

minimal working example: some object FAILED

Expected: a,
Received: ?,

Expected:
[{"frame":0,"notification":{"kind":"N","value":{},"hasValue":true}}]

Received:
[{"frame":0,"notification":{"kind":"N","value":{"someProp":3},"hasValue":true}}],

It seems that jasmine.anything() does want to match {}. So I tried this, but it fails, too:

it('minimal working example: {}', () => {
   const provided = cold('a', { a: {} });
   const expected = cold('a', { a: jasmine.anything() });

    expect(provided).toBeObservable(expected);
});
minimal working example: {} FAILED

Expected: a,
Received: ?,

Expected:
[{"frame":0,"notification":{"kind":"N","value":{},"hasValue":true}}]

Received:
[{"frame":0,"notification":{"kind":"N","value":{},"hasValue":true}}],

Any help is appreciated! Here is an excerpt from my dependencies, in case it is helpful:

(...)
"rxjs": "6.6.3",
(...)
//devDependencies:
(...)
"jasmine": "3.6.4",
"jasmine-core": "3.6.0",
"jasmine-marbles": "0.8.1",
"jasmine-spec-reporter": "6.0.0",
"karma": "~6.1.1",
(...)

Is this related to #11 or #55 ?

EDIT: I just tried different versions. This error does not happen on 0.8.0, which seems to be the latest tag on github. However, the latest npm package is 0.8.1, and there the fault occurs. So #65 seems to be the cause.

@jrista
Copy link

jrista commented Mar 16, 2021

I just upgraded from 0.6.0 to 0.8.1 (and also tried 0.8.0), and am experiencing the same thing. It seems as though Jest expects that result.message is a function, and so if the message property exists, it tries to CALL it. In jasmine-marbles 0.6.0, the message WAS a function, so this works fine. In 0.8.x the message is now just a string, and Jest fails.

@brandonroberts
Copy link
Member

If someone wants to put in a PR to fix, that would be great

TobiDimmel added a commit to TobiDimmel/jasmine-marbles that referenced this issue Jun 17, 2021
TobiDimmel added a commit to TobiDimmel/jasmine-marbles that referenced this issue Jun 24, 2021
TobiDimmel added a commit to TobiDimmel/jasmine-marbles that referenced this issue Jun 24, 2021
TobiDimmel added a commit to TobiDimmel/jasmine-marbles that referenced this issue Jun 24, 2021
brandonroberts added a commit that referenced this issue Sep 28, 2021
@brandonroberts
Copy link
Member

Closed via #86

@brandonroberts
Copy link
Member

Fix released in 0.8.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants