tlvince / eslint-plugin-jasmine

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

`new-line-before-expect` not ignoring earlier `expect` #170

Open briandipalma opened 6 years ago

briandipalma commented 6 years ago

Do you want to request a feature or report a bug?

Bug

What is the current behavior?

The second expect raises a new-line-before-expect warning:

    expect(blockTradeService.cancelQuote).toHaveBeenCalledWith({
      blockId,
      sendClientClose: true
    });
    expect(next).toHaveBeenCalled();

If the current behavior is a bug, please provide the steps to reproduce.

Code above.

What is the expected behavior?

Based on this documentation (also common sense): https://github.com/tlvince/eslint-plugin-jasmine/blob/master/docs/rules/new-line-before-expect.md (last example) no warning.

Please mention your node.js, eslint-plugin-jasmine and operating system version.

node: v10.5.0 eslint-plugin-jasmine: 2.10.1 MacOS: 10.12.6

mikegreiling commented 5 years ago

I can confirm this one as well. It is quite annoying! I believe it only happens when an expect spans multiple lines.

screen shot 2018-10-26 at 1 15 22 pm
ovanderzee commented 3 years ago

I see this bug too, with multiline expect statements like these two times:

        expect(spyConsoleWarn).toHaveBeenCalledWith(
            `inactivityListener rejected unknown-event`,
        )
        expect(spyConsoleWarn).toHaveBeenCalledWith(
            `inactivityListener rejected useless-event`,
        )
        expect(spyAddition).toHaveBeenCalledTimes(0)

eslint-plugin-jasmine: 4.1.1 eslint: 7.15.0 node: 12.18.0 npm: 6.14.4

tva-TIS commented 3 years ago

Probably same reason as #161, everything that is not a line starting with expect( is invalid.

bojingo commented 1 year ago

Issue 161 states that fix was released in version 4.1.3. I am using that version and the issue described here definitely remains.