Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 7 additions & 27 deletions typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -524,24 +524,11 @@ type RetryTo = (fn: (tries: number) => Promise<void> | void, maxTries: number, p
// Globals
declare const codecept_dir: string
declare const output_dir: string
declare const tryTo: TryTo
declare const retryTo: RetryTo
declare const hopeThat: HopeThat

declare const actor: CodeceptJS.actor
declare const codecept_actor: CodeceptJS.actor
declare const Helper: typeof CodeceptJS.Helper
declare const codecept_helper: typeof CodeceptJS.Helper

declare const pause: typeof CodeceptJS.pause
declare const within: typeof CodeceptJS.within
declare const session: typeof CodeceptJS.session
declare const DataTable: typeof CodeceptJS.DataTable
declare const DataTableArgument: typeof CodeceptJS.DataTableArgument
declare const codeceptjs: typeof CodeceptJS
declare const locate: typeof CodeceptJS.Locator.build
declare function inject(): CodeceptJS.SupportObject
declare function inject<T extends keyof CodeceptJS.SupportObject>(name: T): CodeceptJS.SupportObject[T]
declare const secret: typeof CodeceptJS.Secret.secret

// BDD
declare const Given: typeof CodeceptJS.addStep
Expand Down Expand Up @@ -579,21 +566,8 @@ declare namespace NodeJS {
codecept_dir: typeof codecept_dir
output_dir: typeof output_dir

actor: typeof actor
codecept_actor: typeof codecept_actor
Helper: typeof Helper
codecept_helper: typeof codecept_helper
pause: typeof pause
within: typeof within
session: typeof session
DataTable: typeof DataTable
DataTableArgument: typeof DataTableArgument
locate: typeof locate
inject: typeof inject
secret: typeof secret
// plugins
tryTo: typeof tryTo
retryTo: typeof retryTo

// BDD
Given: typeof Given
Expand Down Expand Up @@ -729,6 +703,12 @@ declare module 'codeceptjs' {
* Create a secret value
*/
export const secret: typeof CodeceptJS.Secret.secret

export const session: typeof CodeceptJS.session

export const inject: typeof globalThis.inject

export const locate: typeof CodeceptJS.Locator.build
}

declare module '@codeceptjs/helper' {
Expand Down
14 changes: 0 additions & 14 deletions typings/tests/global-variables.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,3 @@ expectType<CodeceptJS.HookConfig>(
expectType<CodeceptJS.I>(args.I)
}),
)

// @ts-ignore
expectType<Promise<boolean>>(
tryTo(() => {
return true
}),
)

// @ts-ignore
expectType<Promise<boolean>>(
tryTo(async () => {
return false
}),
)
Loading