weird behavior with PhantomJS

207 views
Skip to first unread message

Eric Lemoine

unread,
Sep 25, 2011, 9:21:45 AM9/25/11
to jasmi...@googlegroups.com
Hello

I'm new to this group and Jasmine. Thanks for creating Jasmine,
working with it is a real pleasure.

I'm trying to use Jasmine with PhantomJS, and I'm facing a problem. My
test passes when run in the browser (FF and Chromium), but fails when
run in PhantomJS. With PhantomJS I get the following message:
"Expected '600px' to equal '600px'.", which is... weird.

I've been trying to understand what's going on. I've figured that the
problem may be related to the way the matchersClass is defined in the
Env constructor. If I do this.matchersClass = jasmine.Matchers,
instead of having this.matchersClass inherit from jasmine.Matchers my
test passes in PhantomJS. See [*].

Any idea about what may cause this behavior? And also, anyone knows
why this.matchersClass needs to be a subclass of jasmine.Matchers, the
reason isn't obvious to me.

Thank you!

[*] <https://github.com/elemoine/jasmine/commit/760a61a65f34921f1a1e9742cef75704ab53355b>

--
Eric

DWF

unread,
Jan 9, 2012, 12:36:20 AM1/9/12
to jasmi...@googlegroups.com
The only thing that comes to mind is PhantomJS/Qt's default text encoding. But that doesn't explain why this fix works.

I don't want to pull this change in - the inherits function is used elsewhere - until we understand why.

Have you talked to Airya and the PhantomJS folks?

--dwf

Eric Lemoine

unread,
Jan 10, 2012, 3:42:39 PM1/10/12
to jasmi...@googlegroups.com

Yes, Airya mentioned some Qt/Qt-Webkit 4.6 bug to me. But this is still unclear.

--
Eric

James Coglan

unread,
Feb 8, 2012, 11:48:35 AM2/8/12
to Jasmine
On Jan 9, 5:36 am, DWF <dwfr...@gmail.com> wrote:
> The only thing that comes to mind is PhantomJS/Qt's default text encoding.
> But that doesn't explain why this fix works.

I've found out the core problem: toEqual is not what it should be. See
https://github.com/pivotal/jasmine/issues/174#issuecomment-3870681

James Coglan

unread,
Feb 8, 2012, 11:51:25 AM2/8/12
to Jasmine
On Jan 10, 8:42 pm, Eric Lemoine <eric.lemo...@gmail.com> wrote:
> Yes, Airya mentioned some Qt/Qt-Webkit 4.6 bug to me. But this is still unclear.

What is particularly bizarre is that this bug occurs during the very
common idiom of using for/in to loop over the methods and assign them
to something else. I do this all the time and use Phantom a lot, and
have never seen it before.

The bug is not dependent on the name of the property -- renaming
toEqual to something else across the project does not fix the bug, and
`methodName` is the for/in variable, not external input, so
particularly odd that it doesn't match the keys of the object we're
iterating over.
Reply all
Reply to author
Forward
0 new messages