Skip to content

Some more false negative for testing-library/prefer-screen-queries #391

Open
@julienw

Description

@julienw

Hey @Belco90
I just upgraded to the new version that fixed #367, and I am reporting that it indeed reported new cases...but not all of them!

For example these cases aren't reported still: https://github.com/firefox-devtools/profiler/blob/1c5dfed055f864413b3a62e43ca2d27b074d6108/src/test/components/CallNodeContextMenu.test.js#L107-L112

I'm pretty sure this is because of the spread operator. And indeed I reproduced by slightly adjusting one of the smaller testcases:

import * as React from 'react';
import { render } from 'firefox-profiler/test/fixtures/testing-library';

function setup() {
  const result = render(<div />);
  return { ...result };
}

it('detected', async () => {
  const { getByText } = await setup();

  expect(getByText('foo')).toBeInTheDocument(); // detected
});

it('undetected', () => {
  const { getByText } = setup();

  expect(getByText('foo')).toBeInTheDocument(); // undetected
});

Hope this helps :-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestpinnedPinned for different reasons. Issues with this label won't be flagged as stale by stalebot

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions