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

jasmine/no-focused-tests' endLine includes too much of the test #230

Closed
DamienCassou opened this issue Apr 12, 2020 · 2 comments
Closed
Labels

Comments

@DamienCassou
Copy link
Contributor

Describe the bug

jasmine/no-focused-tests returns an endLine value that represents the whole test. This makes it particularly inconvenient to code on a fit test. As you can see, everything is underlined:

2020-04-12-161219

[
  {
    "filePath": "",
    "messages": [
      {
        "ruleId": "jasmine/no-focused-tests",
        "severity": 2,
        "message": "Unexpected fit.",
        "line": 2,
        "column": 2,
        "nodeType": "CallExpression",
        "endLine": 9,
        "endColumn": 4
      }
    ],
    "..."
  }
]

To Reproduce

  1. Write this code:

    describe("my class", () => {
    	fit("does the work", () => {
    		expect(1 + 1).toBe(2);
    		expect(1 + 2).toBe(3);
    		expect(1 + 3).toBe(4);
    		expect(1 + 4).toBe(5);
    		expect(1 + 5).toBe(6);
    		expect(1 + 6).toBe(7);
    	});
    });
  2. Enable jasmine/no-focused-tests

  3. Run npx eslint --format=json .

  4. The endLine is 9.

Expected behaviour

That endLine is the same as the line, i.e., 2.

The rule mocha/no-exclusive-tests does what I expect by only returning the only part as being wrong:

2020-04-12-162140

Context

  • Node.js version: 10.17.0
  • eslint-plugin-jasmine version: 4.1.0
  • eslint version: 6.8.0
  • Operating system: Fedora 31
DamienCassou added a commit to DamienCassou/eslint-plugin-jasmine that referenced this issue Apr 12, 2020
DamienCassou added a commit to DamienCassou/eslint-plugin-jasmine that referenced this issue Apr 12, 2020
Change endLine and endColumn so only the focused test keyword is
reported as problematic instead of the whole test call. The previous
behavior made working on a focused much harder with editors selecting
all code from line to endLine.

Fixes issue tlvince#230.
@DamienCassou
Copy link
Contributor Author

Please see #231 for a fix.

tlvince pushed a commit that referenced this issue Apr 13, 2020
Change endLine and endColumn so only the focused test keyword is
reported as problematic instead of the whole test call. The previous
behavior made working on a focused much harder with editors selecting
all code from line to endLine.

Fixes issue #230.
@tlvince
Copy link
Owner

tlvince commented Apr 13, 2020

Closed by 796dddf

@tlvince tlvince closed this as completed Apr 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants