eslint-plugin-jasmine icon indicating copy to clipboard operation
eslint-plugin-jasmine copied to clipboard

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

Open briandipalma opened this issue 6 years ago • 4 comments

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

briandipalma avatar Oct 17 '18 10:10 briandipalma

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

mikegreiling avatar Oct 26 '18 18:10 mikegreiling

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

ovanderzee avatar Dec 30 '20 22:12 ovanderzee

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

tva-TIS avatar Mar 19 '21 15:03 tva-TIS

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

bojingo avatar Nov 14 '22 20:11 bojingo