-
Notifications
You must be signed in to change notification settings - Fork 62
'console' is undefined with Qunit in IE 9 #212
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
Comments
4 tasks
https://stackoverflow.com/a/14714140 Secondly, I learned that |
Using https://github.com/paulmillr/console-polyfill I can workaround this problem... |
Krinkle
added a commit
to Krinkle/browserstack-runner
that referenced
this issue
Apr 11, 2021
Follows-up 826d2c7. Before that commit, the reason global "console" was globbered is that the `var console` part of the inner `var console = {}` assignment was hosted by the JavaScript engine. Thus the variable always existed in the local scope as type "undefined", and so the conditional check never saw the real console, and always created a custom one. Thus it always deleted the original console reference, as well as any other it contained. In commit 826d2c7, this was incorrectly fixed by assigning the unchecked expression referring to `console`, thus no longer having a fallback to `{}` in older browsers, because an unchecked reference like that throws an Uncaught ReferenceError. As a result, browserstack-runner was unable to run in IE 9 or older. Fixes browserstack#161. Fixes browserstack#164. Fixes browserstack#212.
Krinkle
added a commit
to qunitjs/browserstack-runner
that referenced
this issue
Apr 11, 2021
Follows-up 826d2c7. Before that commit, the reason global "console" was globbered is that the `var console` part of the inner `var console = {}` assignment was hosted by the JavaScript engine. Thus the variable always existed in the local scope as type "undefined", and so the conditional check never saw the real console, and always created a custom one. Thus it always deleted the original console reference, as well as any other it contained. In commit 826d2c7, this was incorrectly fixed by assigning the unchecked expression referring to `console`, thus no longer having a fallback to `{}` in older browsers, because an unchecked reference like that throws an Uncaught ReferenceError. As a result, browserstack-runner was unable to run in IE 9 or older. Fixes browserstack#161. Fixes browserstack#164. Fixes browserstack#212. Ref browserstack#241.
francisf
pushed a commit
that referenced
this issue
Apr 21, 2021
Follows-up 826d2c7. Before that commit, the reason global "console" was globbered is that the `var console` part of the inner `var console = {}` assignment was hosted by the JavaScript engine. Thus the variable always existed in the local scope as type "undefined", and so the conditional check never saw the real console, and always created a custom one. Thus it always deleted the original console reference, as well as any other it contained. In commit 826d2c7, this was incorrectly fixed by assigning the unchecked expression referring to `console`, thus no longer having a fallback to `{}` in older browsers, because an unchecked reference like that throws an Uncaught ReferenceError. As a result, browserstack-runner was unable to run in IE 9 or older. Fixes #161. Fixes #164. Fixes #212.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Expected Behavior
QUnit test suite with 1 simple test passes successfully.
Actual Behavior
QUnit test suite with 1 simple test fails with global failure due to error `'console' is undefined (see screenshot).
Steps to Reproduce the Problem
index.html
node_modules/.bin/browserstack-runner
Platform details
0.9.0
Details
See screenshot:
The error points to:
browserstack-runner/lib/_patch/browserstack.js
Line 40 in 52b23f0
If I remember IE pecularities correctly this might be because you cannot do
var x = foo || ...
whenfoo
has never been set up before, i.e. is very much indeed undefined. A test liketypeof foo == 'undefined'
might work better/be needed. This could be IE 6-8 knowledge though.PS: also, the runner will just hang until it times out...
The text was updated successfully, but these errors were encountered: