question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Rule tester output not applying all fixes

See original GitHub issue

Tell us about your environment

  • ESLint Version: 5.10.x
  • Node Version: 6-11

While working with rules RuleTester is not applying all fixes, but CLI does.

In RuleTester we have something like this, it means that we are accessing SourceCodeFixer dirrectly instead of having similar logic to verifyAndFix from Linter

const fixResult = SourceCodeFixer.applyFixes(item.code, messages);
assert.strictEqual(fixResult.output, item.output, "Output is incorrect.");

Fixed output of tests is “processed” once instead of ‘less than 10 if there are still fixes to apply’


Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:22 (14 by maintainers)

github_iconTop GitHub Comments

2reactions
mysticateacommented, Mar 8, 2019

The solution in your case would be to call context.report once per identifier change (so report 4 errors, not 2).

No. 😇 The fix of each error may be applied individually, so if it separated errors per identifier change, it may break code; an identifier was renamed but others were not renamed (it makes ReferenceErrors).

2reactions
g-planecommented, Mar 8, 2019

I think we can keep fixing one report by default, but we can provide an option (maybe called applyAllFixes) to allow plugin developer to apply all fixes, which won’t bring breaking change.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fix program errors and improve code - Visual Studio (Windows)
Click on any line of code, right-click to open the context menu, and select Quick Actions and refactorings.
Read more >
Functional Testing: A Complete Guide with Types and Example
An In-Depth Comprehensive Functional Testing Tutorial with Types, Techniques, and Examples: What is Functional Testing?
Read more >
Shrink, obfuscate, and optimize your app - Android Developers
In fact, R8 works with all of your existing ProGuard rules files, so updating the Android Gradle plugin ... By default, this file...
Read more >
Rules | Bazel
Additional attributes are implicitly added to executable and test rules ... that aspect is applied, as long as they do not define the...
Read more >
What is End To End Testing? - BrowserStack
However, every application has to be tested in client or production environments. Chances are that prod environments are not always available ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found