Skip to content

TypeError: references is not iterable / cant parse expect(findBy*) #48

@lkostrowski

Description

@lkostrowski

Error stack

TypeError: references is not iterable
Occurred while linting /Users/lukaszostrowski/projects/mp/src/app/flowers/__tests__/flowers-test.tsx:1

TypeError: references is not iterable
Occurred while linting /Users/lukaszostrowski/projects/mp/src/app/flowers/__tests__/flowers-test.tsx:1
    at Program:exit.testingLibraryQueryUsage.forEach.node (/Users/lukaszostrowski/projects/mp/node_modules/eslint-plugin-testing-library/lib/rules/await-async-query.js:61:37)
    at Array.forEach (<anonymous>)
    at Program:exit (/Users/lukaszostrowski/projects/mp/node_modules/eslint-plugin-testing-library/lib/rules/await-async-query.js:38:34)
    at listeners.(anonymous function).forEach.listener (/Users/lukaszostrowski/projects/mp/node_modules/eslint/lib/linter/safe-emitter.js:45:58)
    at Array.forEach (<anonymous>)
    at Object.emit (/Users/lukaszostrowski/projects/mp/node_modules/eslint/lib/linter/safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (/Users/lukaszostrowski/projects/mp/node_modules/eslint/lib/linter/node-event-generator.js:254:26)
    at NodeEventGenerator.applySelectors (/Users/lukaszostrowski/projects/mp/node_modules/eslint/lib/linter/node-event-generator.js:283:22)
    at NodeEventGenerator.leaveNode (/Users/lukaszostrowski/projects/mp/node_modules/eslint/lib/linter/node-event-generator.js:306:14)
    at CodePathAnalyzer.leaveNode (/Users/lukaszostrowski/projects/mp/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js:655:23)
Process finished with exit code -1

Probably related code:
https://github.com/Belco90/eslint-plugin-testing-library/blob/b38689c69702f08954b456d03752d73b1bee7171/lib/rules/await-async-query.js#L38

Can't provide right now an example , I have to strip few hundreds lines, but maybe its just a matter of checking for references if its actually an array?

Also basing on code it should be expecting await from query, I believe only find* queries should be matched.

I don't have any of them top level, I have few expect(findBy*()).resolves. When I remove them, error is gone

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingreleased

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions