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

'console' is undefined with Qunit in IE 9 #212

Open
carhartl opened this issue Jan 2, 2019 · 2 comments
Open

'console' is undefined with Qunit in IE 9 #212

carhartl opened this issue Jan 2, 2019 · 2 comments

Comments

@carhartl
Copy link

@carhartl carhartl commented Jan 2, 2019

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

  1. single test suite index.html
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>Test Suite</title>
		<link href="node_modules/qunitjs/qunit/qunit.css" rel="stylesheet">
		<script src="node_modules/qunitjs/qunit/qunit.js"></script>
		<script>
			QUnit.test('simple value', function (assert) {
				assert.expect(1);
				assert.strictEqual(true, true, 'testing...');
			});
		</script>
	</head>
	<body>
		<div id="qunit"></div>
		<div id="qunit-fixture"></div>
	</body>
</html>
  1. browserstack config:
{
    "test_framework" : "qunit",
    "test_path": [
        "index.html"
    ],
    "exit_with_fail": true,
    "browsers": [
        "ie_9"
    ]
}
  1. Execute node_modules/.bin/browserstack-runner

Platform details

  1. browserstack-runner version: 0.9.0
  2. node version: v11.6.0
  3. os type and version: OSX Mojave 10.14.2

Details

See screenshot:

screenshot 2019-01-02 at 19 22 54

The error points to:

var browserstack_console = console || window.console || {};

If I remember IE pecularities correctly this might be because you cannot do var x = foo || ... when foo has never been set up before, i.e. is very much indeed undefined. A test like typeof 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...

Launching 1 worker(s) for 1 run(s).
[Windows 7, Internet Explorer 9.0] Launching
[Windows 7, Internet Explorer 9.0] Received ack
[Windows 7, Internet Explorer 9.0] Launched
[Windows 7, Internet Explorer 9.0] Awaiting ack
@carhartl carhartl mentioned this issue Jan 2, 2019
4 of 4 tasks complete
@carhartl
Copy link
Author

@carhartl carhartl commented Jan 2, 2019

https://stackoverflow.com/a/14714140

Secondly, I learned that console is only available in IE 9 if developer tools are open.

@carhartl
Copy link
Author

@carhartl carhartl commented Jan 2, 2019

Using https://github.com/paulmillr/console-polyfill I can workaround this problem...

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

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.