Skip to content

(TS) Type SelectorMatcherOptions is missing timeout #43

Closed
@ShimiTheFirst

Description

@ShimiTheFirst
  • cypress-testing-library version: 3.0.1
  • node version: 10.13.0
  • yarn version: 1.13.0

Relevant code or config

cy.queryByText("foo", { timeout: 100 })

What you did:
Tried to change the value of the timeout option on queryByText.

What happened:
The test correctly waited for the set amount of time (100ms) but TS validation reports an error:
ctl-type-err

Problem description:
Queries using the SelectorMatcherOptions type are missing the type definition for the timeout option.

Suggested solution:
If this is not intentional, take the same approach as for MatcherOptions in #28 – update typings/index.d.ts.

How it is now:

import {
  SelectorMatcherOptions,
  Matcher,
  MatcherOptions as DTLMatcherOptions,
  getByTestId,
} from 'dom-testing-library'

export interface CTLMatcherOptions {
  timeout?: number
}

export type MatcherOptions = DTLMatcherOptions | CTLMatcherOptions

How it could be:


import {
  SelectorMatcherOptions as DTLSelectorMatcherOptions,
  Matcher,
  MatcherOptions as DTLMatcherOptions,
  getByTestId,
} from 'dom-testing-library'


export interface CTLMatcherOptions {
  timeout?: number
}

export type MatcherOptions = DTLMatcherOptions | CTLMatcherOptions
export type SelectorMatcherOptions = DTLSelectorMatcherOptions | CTLMatcherOptions

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions