Skip to content
Closed
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
30 changes: 30 additions & 0 deletions typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,36 @@ declare namespace Mocha {

declare module 'codeceptjs' {
export default codeceptjs
export const codecept: typeof CodeceptJS.Codecept
export const Codecept: typeof CodeceptJS.Codecept
export const output: typeof CodeceptJS.output
export const container: {
helpers(name?: string): any
support(name?: string): any
plugins(name?: string): any
translation(): any
mocha(): any
result(): any
append(newContainer: any): void
clear(newHelpers?: any, newSupport?: any, newPlugins?: any): Promise<void>
started(fn?: Function | null): Promise<void>
share(data: any, options?: any): void
createMocha(config?: any, opts?: any): void
actor(): any
}
export const event: typeof CodeceptJS.event
export const recorder: CodeceptJS.recorder
export const config: typeof CodeceptJS.Config
export const actor: CodeceptJS.actor
export const helper: typeof CodeceptJS.Helper
export const Helper: typeof CodeceptJS.Helper
export const pause: typeof CodeceptJS.pause
export const within: typeof CodeceptJS.within
export const dataTable: typeof CodeceptJS.DataTable
export const dataTableArgument: typeof CodeceptJS.DataTableArgument
export const store: typeof CodeceptJS.store
export const locator: typeof CodeceptJS.Locator

}

declare module '@codeceptjs/helper' {
Expand Down
24 changes: 24 additions & 0 deletions typings/tests/import-exports.types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { expectType } from 'tsd'
import { container, codecept, Codecept, output, event, recorder, config, actor, helper, Helper, pause, within, dataTable, dataTableArgument, store, locator } from 'codeceptjs'

// Test that container can be imported and has the expected methods
const helpers = container.helpers()
const helper1 = container.helpers('Playwright')
const support = container.support()
const plugins = container.plugins()

expectType<typeof CodeceptJS.Codecept>(codecept)
expectType<typeof CodeceptJS.Codecept>(Codecept)
expectType<typeof CodeceptJS.output>(output)
expectType<typeof CodeceptJS.event>(event)
expectType<CodeceptJS.recorder>(recorder)
expectType<typeof CodeceptJS.Config>(config)
expectType<CodeceptJS.actor>(actor)
expectType<typeof CodeceptJS.Helper>(helper)
expectType<typeof CodeceptJS.Helper>(Helper)
expectType<typeof CodeceptJS.pause>(pause)
expectType<typeof CodeceptJS.within>(within)
expectType<typeof CodeceptJS.DataTable>(dataTable)
expectType<typeof CodeceptJS.DataTableArgument>(dataTableArgument)
expectType<typeof CodeceptJS.store>(store)
expectType<typeof CodeceptJS.Locator>(locator)
Loading