-
Notifications
You must be signed in to change notification settings - Fork 783
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
TAP reporter prints 'Infinity' in a failing test as 'null' #1406
Comments
I researched a little bit more. Not only // my_test_file.js
QUnit.test('null tests', function(assert) {
assert.strictEqual(null, Infinity, 'null vs Infinity');
assert.strictEqual(null, -Infinity, 'null vs -Infinity');
assert.strictEqual(null, NaN, 'null vs NaN');
assert.strictEqual(null, undefined, 'null vs undefined');
assert.strictEqual(null, 0, 'null vs 0');
}); Running
|
Hi @mathiasbockwoldt, thanks for the issue. Is this only showing up in the TAP reporter? Do you know if the same issue shows up in the HTML reporter? |
Thank you @mathiasbockwoldt for doing that test and helping us narrow the issue down to the TAP reporter! |
I suspect this likely due to a JSON serialisation step happening somewhere between QUnit and the TAP reporter we use. Complex number values like Infinity and NaN are not supported in JSON. Having said that, since there is no cross-process communication (I think?) there should not be a need to serialise these. |
This might be related to qunitjs/js-reporters#110. Based on that, it seems TAP wants to be given strings to display, which means we may need to stringify these within QUnit first and thus not expose to reporters at all as the native values that they are. @rwjblue Does that sound right? |
This was fixed upstream by qunitjs/js-reporters@7ec72e3. I've added a test for it in qunitjs/js-reporters@31ab6e0fbf849bd0. The issue was indeed the way the TapReporter converted JS values to JSON/YAML. This will apply to QUnit after the next js-reporters release. |
Fixes qunitjs#1340. Fixes qunitjs#1406. Fixes qunitjs#1555.
Fixes qunitjs#1340. Fixes qunitjs#1406. Fixes qunitjs#1407. Fixes qunitjs#1555.
Tell us about your runtime:
qunit my_test_file.js
; Linux Mint 19.1; Kernel v. 4.15.0)What are you trying to do?
Code that reproduces the problem:
Run using
qunit my_test_file.js
.What did you expect to happen?
I expect to see an error that should look approximately like this. Note the
expected: Infinity
.What actually happened?
Note the
expected: null
.I don't know much about the internals of QUnit, but this smells JSON conversion.
The text was updated successfully, but these errors were encountered: