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

Only jQuery.click() triggers error caught by assert.throws #453

Closed
nlfurniss opened this issue Nov 1, 2018 · 1 comment · May be fixed by #1194
Closed

Only jQuery.click() triggers error caught by assert.throws #453

nlfurniss opened this issue Nov 1, 2018 · 1 comment · May be fixed by #1194

Comments

@nlfurniss
Copy link
Contributor

nlfurniss commented Nov 1, 2018

This twiddle reproduces the issue.

TLDR

There is a component that will throw an error if two attrs arent passed in (x and y) and the component is clicked on.

There are three tests:

  1. Ensure no errors if both attrs passed in and component is clicked ✅
  2. Ensure an error is throw when only one attr is passed in and component is clicked (uses native JS and tests fails) ❌
  3. Ensure an error is throw when only one attr is passed in and component is clicked (uses jquery and test passes) ✅

Here is where things go wrong:

// Qunit throws
try {
   block.call(currentTest.testEnvironment);  <====== This call doesnt trigger an error when it uses native JS. But FUN FACT: if you highlight this line at a breakpoint, it will log an error (???)
} catch (e) {
   actual = e;
}
...
if (actual) {     <==== `actual` needs to be set otherwise it wont catch the error and the test will fail.

Originally posted by @nlfurniss in #310 (comment)

@NullVoxPopuli
Copy link
Collaborator

Hello! thanks for reporting!

I'm going to close this, as we have some new techniques for capturing errors now,

However, if you still feel something is missing feel free to open a new issue, and let's work on a more up to date repro of the problem 💪 thank you!!! ❤️ 🥳

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants