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

Allow chai usage integration. #864

Open
leobalter opened this Issue Sep 28, 2015 · 1 comment

Comments

2 participants
@leobalter
Member

leobalter commented Sep 28, 2015

I'm thinking about creating a assert adaptor to allow the use of custom assertion libs, as Chai.

To start I thinking on something like:

QUnit.config.assert = "chai";

or

QUnit.setup({
  assert: "chai",
  reporter: "HTML"
});

I know QUnit.setup is not even in the plans, this is something to maybe discuss in another issue.

Possible drawbacks: having chai plugged in, QUnit would probably break a test on its first failing assertion, but wouldn't fail without a builtin assertion call, along with the expect method.

Probably, the necessary steps to implement this is:

  • avoid QUnit tests failing without any of its builtin assertions call.
  • catch chai thrown errors from the assertions and report it as failing
  • a test without any failing assertion should pass (that's silly, but...)

Maybe we can register the chai assertions calls, worth investigate: https://github.com/chaijs/chai/blob/master/lib/chai/assertion.js#L99-L113


Extra: this could be extended to node's assert module as well.

@jzaefferer

This comment has been minimized.

Show comment
Hide comment
@jzaefferer

jzaefferer Sep 29, 2015

Member

Might be possible to wrap each assertion to catch the AssertionError and pass it through to pushFailure, including the stack.

Supporting node's assert module also sounds interesting.

Member

jzaefferer commented Sep 29, 2015

Might be possible to wrap each assertion to catch the AssertionError and pass it through to pushFailure, including the stack.

Supporting node's assert module also sounds interesting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment