tlvince / eslint-plugin-jasmine

ESLint rules for Jasmine
https://www.npmjs.com/package/eslint-plugin-jasmine
MIT License
95 stars 58 forks source link

prefer-toBeUndefined produces AssertionError on found error #355

Open pascal-puetz opened 2 years ago

pascal-puetz commented 2 years ago

Describe the bug

The jasmine/prefer-toBeUndefined rule produces an Assertion error when any spec file is found that contains a hit (e.g. expect(undefined).toBe(undefined) with {"jasmine/prefer-toBeUndefined": "error"} config).

The error only occurs on versions 4.x.x and did not occur on 3.0.0.

To Reproduce

Set the jasmine/prefer-toBeUndefined config to "error" and produce an error in any spec file. Afterwards, lint that file. This produces the following error and crashes eslint:

Oops! Something went wrong! :(

ESLint: 8.22.0

AssertionError [ERR_ASSERTION]: Fix has invalid range: {
  "range": [
    null,
    null
  ],
  "text": "toBeUndefined("
}

Expected behaviour

Eslint should report the error as usual and should not crash.

Context

BePo65 commented 1 year ago

I have the same error. Not sure what would be the correct configuration. I am using "jasmine/prefer-toBeUndefined": ["warn", "always"].