Skip to content

bug: Errors when using testing-library/dom #5619

@angelo-v

Description

@angelo-v

Prerequisites

Stencil Version

4.14.0

Current Behavior

Following up on #5252 (comment): When using testing-library/dom with stencil errors occur when using getByRole and getByLabelText

getByRole

Right-hand side of 'instanceof' is not an object

getByLabelText:

TestingLibraryElementError: Found a label with the text of: Test, however no form control was found associated to that label. Make sure you're using the "for" attribute or "aria-labelledby" attribute correctly.

Expected Behavior

Both methods should find the respective element without errors

System Info

@testing-library/dom: 9.3.4
@testing-library/jest-dom: 6.4.2
▶ npx stencil info

      System: node 21.6.1
    Compiler: [...]/node_modules/@stencil/core/compiler/stencil.js
       Build: 1711981251
     Stencil: 4.14.0 🚡
  TypeScript: 5.4.3
      Rollup: 2.56.3
      Parse5: 7.1.2
      jQuery: 4.0.0-pre
      Terser: 5.30.0

Steps to Reproduce

see repo

Code Reproduction URL

https://github.com/angelo-v/stencil-testing-library-dom-error/blob/8cc444465b5db82efd6ec7a71c00a7b60f8e08e4/src/components/my-component/my-component.spec.ts

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bug: ValidatedThis PR or Issue is verified to be a bug within Stencil

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions