Skip to content

Documentation: Missing Type Information in Service Configuration #728

@htho

Description

@htho

Pre-check

Describe the improvement

I'd like to report

  • Unclear documentation
  • A typo
  • Missing documentation
  • Other

Description of the improvement / report

I created a repository where I tried to reproduce the problems I found, when setting up visual testing: https://github.com/htho/wdio-repro-visual-service

TypeScript can't tell, what type to expect for the configuration object for visual.
This could be improved, so we have IntelliSense when editing the object.

https://github.com/htho/wdio-repro-visual-service/blob/main/wdio-default.conf.ts#L11-L20

services: [
    [
        "visual",
        {
            // no automatic type information
            // therefore the `satisfies VisualServiceOptions` below.
            // TODO: REPORT
        } satisfies VisualServiceOptions,
    ],
],

To fix this I added satisfies VisualServiceOptions.

I gather the type like this, because VisualServiceOptions is not exported.

https://github.com/htho/wdio-repro-visual-service/blob/main/wdio-default.conf.ts#L2-L7

import type { ClassOptions } from 'webdriver-image-comparison';

// should be exported
// TODO: REPORT
// https://github.com/webdriverio/visual-testing/blob/f4d9e654a746d09e9ca2567ffe69200c161cc14b/packages/visual-service/src/types.ts#L62
type VisualServiceOptions = ClassOptions;

To improve Documentation/DX, VisualServiceOptions should be available for import.
Also there should be type information, about the config object for visual

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions