-
Notifications
You must be signed in to change notification settings - Fork 298
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
Playwright V2 E2E Framework #4706
Changes from 5 commits
416fe3c
10f01db
2504e51
a309bdc
1ec99e2
e75a2f6
3e25a3f
954514f
08781ab
e1c9748
139996b
77e6f2e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ out/ | |
.env | ||
.idea/ | ||
.run/ | ||
.test/ | ||
**/*.iml | ||
**/*.vsix | ||
index.scip | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -99,3 +99,25 @@ export function createSubscriber<T>(): Subscriber<T> { | |
export function nextTick() { | ||
return new Promise(resolve => process.nextTick(resolve)) | ||
} | ||
|
||
export type SemverString<Prefix extends string> = `${Prefix}${number}.${number}.${number}` | ||
|
||
export namespace SemverString { | ||
const splitPrefixRegex = /^(?<prefix>.*)(?<version>\d+\.\d+\.\d+)$/ | ||
export function forcePrefix<P extends string>(prefix: P, value: string): SemverString<P> { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are you sure the version strings are always semver? What value do we have in enforcing this now? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This type is used in the two locations where the only "guard" against mis-use was a comment left above it. Especially with the fact that one of them uses a 'v' and the other doesn't made that I had a very hard to debug issue as I simply misread the urls the whole time. This essentially just captures those two original comments as type-checks. |
||
const match = splitPrefixRegex.exec(value) | ||
if (!match || !match.groups?.version) { | ||
throw new Error(`Invalid semver string: ${value}`) | ||
} | ||
return `${prefix}${match.groups?.version}` as SemverString<P> | ||
} | ||
} | ||
|
||
type TupleFromUnion<T, U = T> = [T] extends [never] | ||
? [] | ||
: T extends any | ||
? [T, ...TupleFromUnion<Exclude<U, T>>] | ||
: [] | ||
|
||
// Helper type to ensure an array contains all members of T | ||
export type ArrayContainsAll<T extends string> = TupleFromUnion<T> |
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.
FYI this doesn't mean the same as before since apiURL is an absolute path it will remove any path from baseUrl. What motivated this change? I do think this is safe though, since sourcegraph doesn't generally support not being the root of a domain.