Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[jest/prefer-spy-on]: Fix objects must not be overlapped in a report. #175

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

Closed
wKovacs64 opened this issue Jan 31, 2019 · 1 comment · Fixed by jest-community/eslint-plugin-jest#221
Labels
package: parser Issues related to @typescript-eslint/parser

Comments

@wKovacs64
Copy link

What code were you trying to parse?

test('prefer-spy-on', () => {
  console.log = jest.fn();
});

What did you expect to happen?

I expected the rule to work.

What actually happened?

AssertionError [ERR_ASSERTION]: Fix objects must not be overlapped in a report.
    at mergeFixes (/Users/user/project/node_modules/eslint/lib/util/report-translator.js:150:9)
    at normalizeFixes (/Users/user/project/node_modules/eslint/lib/util/report-translator.js:180:16)
    at args (/Users/user/project/node_modules/eslint/lib/util/report-translator.js:278:18)
    at Object.report (/Users/user/project/node_modules/eslint/lib/linter.js:720:41)
    at AssignmentExpression (/Users/user/project/node_modules/eslint-plugin-jest/rules/prefer-spy-on.js:41:17)
    at listeners.(anonymous function).forEach.listener (/Users/user/project/node_modules/eslint/lib/util/safe-emitter.js:45:58)
    at Array.forEach (<anonymous>)
    at Object.emit (/Users/user/project/node_modules/eslint/lib/util/safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (/Users/user/project/node_modules/eslint/lib/util/node-event-generator.js:251:26)
    at NodeEventGenerator.applySelectors (/Users/user/project/node_modules/eslint/lib/util/node-event-generator.js:280:22)

Versions

package version
@typescript-eslint/parser 1.1.1
TypeScript 3.2.4
ESLint 5.12.1
node 11.7.0
npm 6.5.0
eslint-plugin-jest 22.2.1

prefer-spy-on source

@wKovacs64 wKovacs64 added package: parser Issues related to @typescript-eslint/parser triage Waiting for team members to take a look labels Jan 31, 2019
@armano2
Copy link
Collaborator

armano2 commented Jan 31, 2019

issue is related to this plugin, they are using non standard fields from AST
end and start should not be used, this rule should use range[0], range[1] instead

https://eslint.org/docs/developer-guide/working-with-custom-parsers#all-nodes

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
package: parser Issues related to @typescript-eslint/parser
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants