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

test-ended rule does not like macros: #119

Closed
jamestalmage opened this issue Jun 2, 2016 · 4 comments · Fixed by #234
Closed

test-ended rule does not like macros: #119

jamestalmage opened this issue Jun 2, 2016 · 4 comments · Fixed by #234
Labels
enhancement 🎁 Rewarded on Issuehunt This issue has been rewarded on Issuehunt help wanted

Comments

@jamestalmage
Copy link
Contributor

jamestalmage commented Jun 2, 2016

Issuehunt badges

function cbMacro(t, input, expected) {
  fn(input, output => {
     t.is(output, expected);
     t.end();
  });
}

test.cb(cbMacro, 'foo', 'FOO'); // <-- violates the rule, but it shouldn't.
test.cb(cbMacro, 'bar', 'BAR');

gmartigny earned $20.00 by resolving this issue!

@IssueHuntBot
Copy link

@IssueHunt has funded $20.00 to this issue.


@GMartigny
Copy link
Contributor

How should the plugin react to this kind of case ?

I see two distinct possibilities:

test.cb(macro);
test.cb(t => {
  macro();
});

In the first case, we can "simply" disable the warning if test.cb first argument is a reference (we can at least check that the reference exists).

In the second case however, assuming that any function calls disable the rule renders it irrelevant. Most of the time (all the time ?), a test.cb will a call a function to test.

@novemberborn
Copy link
Member

In the first case, we can "simply" disable the warning if test.cb first argument is a reference (we can at least check that the reference exists).

This sounds good to me.

@IssueHuntBot
Copy link

@sindresorhus has rewarded $18.00 to @GMartigny. See it on IssueHunt

  • 💰 Total deposit: $20.00
  • 🎉 Repository reward(0%): $0.00
  • 🔧 Service fee(10%): $2.00

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement 🎁 Rewarded on Issuehunt This issue has been rewarded on Issuehunt help wanted
Projects
None yet
5 participants