elwayman02 / ember-sinon-qunit

Sinon sandbox test integration for QUnit
MIT License
56 stars 30 forks source link

[BREAKING] commonConfig is no longer called #222

Open sukima opened 5 years ago

sukima commented 5 years ago

In the past the use of the wrapped test/only would setup sinon to use QUnit's assertions for sinon's assertions. This was a big win as sinons assertion API is far superior, more readable, and offered better messaging then doing so manually via QUnit.assert.

However these helpers have been deprecated and the official documentation is to use the setupSinon which does not call commonConfig and therefor does not setup the assertion methods. This means that use of sinon's assertion API will not reflect in the QUnit reporting when they pass and will halt a test from continuing asserts because the default is to throw instead of fail like QUnit usually does.

Can setupSinon include this very minor but much wanted setup. It follows the same pattern as sinon's qunit integration guidelines.

Thank you.

sukima commented 3 years ago

For those curious you can manually enable sinon's assert API with the following lines:

import QUnit from 'qunit';
import sinon from 'sinon';

sinon.assert.pass = (assertion) => QUnit.assert.ok(true, assertion);
sinon.assert.fail = (assertion) => QUnit.assert.ok(false, assertion);

If the Authors are interested in including this into the current setupSinon I'll gladly make a PR for that.