inluxc / playwright-xray

XRAY reporter for Playwright
MIT License
27 stars 11 forks source link

Optional configuration mandatory in `XrayOptions` type #89

Open csvtuda opened 15 hours ago

csvtuda commented 15 hours ago

Hi,

in #86 you exposed the XrayOptions to users of the reporter (thanks for that!). But I think there's a small issue with the optional properties.

According to the documentation, stepCategories and summary are optional settings. But in XrayOptions, they are required.

MRE

import {XrayOptions} from "playwright-xray"

const x = {
  jira: {
    url: 'https://hello.atlassian.net/',
    type: 'cloud',
    apiVersion: '1.0',
  },
  cloud: {
    client_id: 'ID',
    client_secret: 'SECRET',
  },
  projectKey: 'DP',
  testPlan: 'DP-71',
  testExecution: 'DP-72',
  debug: false,
} satisfies XrayOptions;

error

Expected behaviour

I guess our expected behaviour would be either to update the documentation or to mark them as optional in the type.

I hope suggestions are welcome: I assume you've not made them optional because internally, your reporter always has the summary and steps defined. What I've usually done in the past when developing plugins is to split the configuration types into an internal (not exported) and an external (exported to users) version so that internally I can use the required summary without adding if (config.summary) unnecessarily.

Desktop (please complete the following information):