A method to obtain meaningful Errors

91 views
Skip to first unread message

Jared Clemence

unread,
Apr 2, 2015, 11:59:16 AM4/2/15
to jasmi...@googlegroups.com
Dear all:

I am learning jasmine. I have written a script that runs perfectly on Mac OS X. When I run the same script on a Windows 8.1 environment, all the tests fail.

Debugging shows that all the expect().toBe() values meet expectations.  All "null" expectations are "null".  All object tests prove the correct object identity and so forth.  However, still every test fails with the message:

[object Object] thrown


How do I obtain a more meaningful message than "[object Object] thrown" to identify the problem in the script?

At first, I thought the problem was associated with the done() function, but I have copied the Asynchronous spec tests from the website and found this is not the case.  I must find out what the source of the "[object Object] thrown" is to move further.  All assistance and suggestions are appreciated.

Kind regards,

Jared Clemence

Gregg Van Hove

unread,
Apr 2, 2015, 3:59:31 PM4/2/15
to jasmi...@googlegroups.com
A few questions to help try to narrow down whats going on...

What version of jasmine are you using?

How are you running the specs?

Are they browser specs or node specs? If they're browser specs, can you narrow it down to a particular browser or is it all browsers on Windows?

-Gregg

--
You received this message because you are subscribed to the Google Groups "Jasmine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jasmine-js+...@googlegroups.com.
To post to this group, send email to jasmi...@googlegroups.com.
Visit this group at http://groups.google.com/group/jasmine-js.
For more options, visit https://groups.google.com/d/optout.

Jared Clemence

unread,
Apr 2, 2015, 6:07:59 PM4/2/15
to jasmi...@googlegroups.com
Good questions.

I am running 2.2.

The specs are loaded with a single script:

  <!-- include spec files here... -->
  <script src="spec/MedFaceFileSystem.js"></script>

I am not sure what the difference is between browser specs and node specs.  I used the information available at http://jasmine.github.io/2.2/introduction.html to create a series of nested describe(), it() and expect() statements to test javscript objects that are defined in a file loaded as follows:

  <!-- include source files here... -->
  <script src="../FileSystem/js/FileSystemIO.js"></script>

I have verified that both files load correctly.  On Mac I get no errors. On Windows I get lots of errors.  Instead of seeing things like "Expected 1 to be 0" or "Expected null not to be null", I am seeing "[object Object] thrown".

-Jared

Gregg Van Hove

unread,
Apr 8, 2015, 7:44:10 PM4/8/15
to jasmi...@googlegroups.com
It sounds like you're doing something that Internet Explorer doesn't like and it's throwing some kind of Error. Jasmine does it's best to try to format errors so they're readable, but if we are unable to extract a `name` and `message` from the object that was thrown, we fall back to `toString()` which is what is returning '[object Object]' in Internet Explorer, thus making it difficult to debug what exactly Internet Explorer doesn't like in the first place.

Is this happening for all of your specs or just some?

-Gregg

Jared Clemence

unread,
Apr 16, 2015, 6:17:04 PM4/16/15
to jasmi...@googlegroups.com
It is happening to all of the specs.

I have successfully debugged the application that was causing the problem, but the errors persist.

In what file can I find the error handling?  Perhaps if I can put the error to console.log before it is thrown, I can see more detail about it's structure and where it might be coming from on future occurrences?

--
You received this message because you are subscribed to a topic in the Google Groups "Jasmine" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jasmine-js/GcK1hs0F4FA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jasmine-js+...@googlegroups.com.

To post to this group, send email to jasmi...@googlegroups.com.
Visit this group at http://groups.google.com/group/jasmine-js.
For more options, visit https://groups.google.com/d/optout.



--
Kind regards,

Jared Clemence
Independant Programmer/Developer

Gregg Van Hove

unread,
May 6, 2015, 1:26:23 PM5/6/15
to jasmi...@googlegroups.com
I you want to inspect the exception, you probably want to look in the `handleException` function in the `QueueRunner`

Jared Clemence

unread,
May 9, 2015, 10:47:31 AM5/9/15
to jasmi...@googlegroups.com

Thank you!

Reply all
Reply to author
Forward
0 new messages