Closed mykoweb closed 10 years ago
So, it may pass in the browser, but you probably see the same exception if you open the debug console.. correct? I'll move forward with that assumption, but it may be incorrect. I've never seen the get$
method, but it may exist in one of your dependencies, or it could be a typo? @gvarela took a quick look, and thinks it may be a closure issue.
If you want advice about what you're using to test with, you may consider jasmine over qunit.
Either way, let me know what you figure out.
Oh, to clarify, it's not an errant test, it's an exception that qunit captures.. you'll notice it's a "global failure" -- meaning you shouldn't have any exceptions.
I do not see the same exception in the debug console which is weird.
I found the get$ method in the ember-auth-* gems. When I removed these gems from the manifest, the test passes without the global failure.
I'll dig some more to see why this is failing the way it is. Closing this issue.
Thanks
Good. It's worth mentioning, that phantomjs (the default runner) is pretty much the same as a browser, but it's not entirely 1:1.. If you want to use those, try using the selenium runner, because it will fire up firefox and run your tests in a full browser. If you're curious you can give that a shot, and see if it has something to do with phantomjs vs a real browser.
I dug some more and it looks like it may be a browser issue.
The piece of code causing the error is from one of the ember-auth gems (ember-auth-module-ember-data):
get$(this, 'auth').addHandler('signInSuccess', get$(this, 'findUser').bind(this));
This code is automatically generated by EmberScript.
Anyway, when I debug in the Chrome console (btw, the tests are passing in Chrome without errors), it looks like my tests are properly parsing native code provided by Chrome. Here is the output from the debug console:
> get$(this, 'findUser').bind(this).toString() "function () { [native code] }"
However, when doing the same thing in Safari (where the tests are passing, but I see an error in the debug console), this is what I get:
> get$(this, 'findUser').bind(this).toString() TypeError: 'undefined' is not an object (evaluating 'get$(this, 'findUser').bind') line: 2 message: "'undefined' is not an object (evaluating 'get$(this, 'findUser').bind')" stack: "eval code↵eval@[native code]↵_evaluateOn↵↵_evaluateAndWrap↵↵evaluate↵↵[native code]" __proto__: Error constructor: function TypeError() { message: "" name: "TypeError" toString: function toString() { __proto__: Error
In PhantomJS, I get the same 'undefined' error.
At least I have tests working in Chrome. Switching to Selenium won't help since this error also occurs in Firefox.
Any ideas on how I could resolve this would be greatly appreciated, other than just running my tests in Chrome.
Thanks.
Ah, I've seen this issue before -- and it has nothing to do with Teaspoon etc.. I'll help by clarifying, but in the future please be kind to open source devs and do the digging before creating an issue. =) Not meant to be a dig, but I do have a day job.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind
.bind
in your case is binding the function scope, but that's not available everywhere.. phantomjs is safari more or less, so it's good that you are checking there -- it will give you the same results 99% of the time. The link I provide has a polyfill, so you may want to use that to get it behaving everywhere. That's your problem.
see #139 as well.
Thanks @jejacks0n, and apologies for the bother. Cheers
BTW, I added the polyfill and it resolved the issue.
Many thanks @jejacks0n !
I'm pretty new to Teaspoon so this may be user error.
I'm running Rails 4.0.2, Ruby 2.0.0p353, Teaspoon 0.7.8, Qunit, and Ember 1.3.0. I only have one test and it passes when I run teaspoon from the browser.
However, when I try to run from the command line, it runs my one and only passing test, but then it seems to run another test and that test fails. I can't figure out what that second test is. I've looked in my assets and tests directories to try to find this rogue test and can't find it. Here is the output:
My test_helper.js file includes all the relevant JS files:
Here is the manifest from application.js:
and the manifest from kp.js:
I looked in all of these files and directories to see if some errant test was defined, but there is none.
Any clue as to where that second test is coming from and why it's failing?
Again, when I run teaspoon from the browser, it runs fine and this errant test is not run.
Thanks