forked from webdriverio/webdriverio
-
Notifications
You must be signed in to change notification settings - Fork 0
fix(wdio-browserstack-service): ship a11y Browser type augmentations #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
harshit-browserstack
wants to merge
4
commits into
main
Choose a base branch
from
fix/wdio-browserstack-service-a11y-browser-types
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
b4253ea
fix(wdio-browserstack-service): ship a11y Browser type augmentations
harshit-browserstack 93f88bf
fix(wdio-browserstack-service): drop MultiRemoteBrowser a11y augmenta…
harshit-browserstack ee6aaa1
chore(wdio-browserstack-service): remove dead bstack-service-types.d.…
harshit-browserstack 94cd4dc
test(wdio-browserstack-service): guard a11y Browser type augmentation
harshit-browserstack File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
17 changes: 0 additions & 17 deletions
17
packages/wdio-browserstack-service/src/@types/bstack-service-types.d.ts
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
packages/wdio-browserstack-service/src/accessibility-handler.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
packages/wdio-browserstack-service/src/cli/modules/accessibilityModule.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| import { expectType } from 'tsd' | ||
| import { browser } from '@wdio/globals' | ||
|
|
||
| /** | ||
| * Regression guard for the @wdio/browserstack-service accessibility | ||
| * augmentation of WebdriverIO.Browser. | ||
| * | ||
| * These five methods are declared inside | ||
| * declare global { namespace WebdriverIO { interface Browser { ... } } } | ||
| * in packages/wdio-browserstack-service/src/index.ts. They previously lived | ||
| * in an un-emitted ambient .d.ts file and silently never reached the published | ||
| * build/index.d.ts, so consumers lost the typings. This file pulls in the | ||
| * published @wdio/browserstack-service types (it is listed in this suite's | ||
| * tsconfig.json `types` array) and fails `test:typings:webdriverio` if any of | ||
| * the five methods ever stops being typed on WebdriverIO.Browser again. | ||
| */ | ||
| ;(async () => { | ||
| expectType<() => Promise<Record<string, unknown>>>(browser.getAccessibilityResultsSummary) | ||
| expectType<() => Promise<Array<Record<string, unknown>>>>(browser.getAccessibilityResults) | ||
| expectType<() => Promise<Record<string, unknown> | undefined>>(browser.performScan) | ||
| expectType<() => Promise<void>>(browser.startA11yScanning) | ||
| expectType<() => Promise<void>>(browser.stopA11yScanning) | ||
|
|
||
| // also assert the call-site return types resolve as declared | ||
| expectType<Record<string, unknown>>(await browser.getAccessibilityResultsSummary()) | ||
| expectType<Array<Record<string, unknown>>>(await browser.getAccessibilityResults()) | ||
| expectType<Record<string, unknown> | undefined>(await browser.performScan()) | ||
| expectType<void>(await browser.startA11yScanning()) | ||
| expectType<void>(await browser.stopA11yScanning()) | ||
| }) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No regression guard ships with this. These declarations lived in an un-emitted ambient file since the original v8 a11y PR and silently never reached consumers across multiple subsequent PRs — exactly the kind of failure that recurs. Recommend adding a type-level test (tsd, or a
tests/typingsfixture compiled in CI) that assertsbrowser.startA11yScanning,getAccessibilityResultsSummary, etc. are typed onWebdriverIO.Browser. That way CI fails if the augmentation ever stops emitting again, instead of a customer finding it.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added in
94cd4dc49—tests/typings/webdriverio/browserstackService.tsasserts (tsdexpectType) that all 5 a11y methods are typed onWebdriverIO.Browser, both as function properties and via their awaited return types.It hooks into the repo's existing
test:typings:webdriverioCI script — that suite already symlinks the package's built types and lists@wdio/browserstack-servicein its tsconfigtypes, so the guard checks the exact published consumer surface that regressed here. No new framework or CI job added.Verified: compiles clean with the augmentation present, and fails with
TS2339on all 5 methods if theinterface Browserblock is removed.