diff --git a/typings/index.d.ts b/typings/index.d.ts index aba11e7a2..5563e418d 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -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 + started(fn?: Function | null): Promise + 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' { diff --git a/typings/tests/import-exports.types.ts b/typings/tests/import-exports.types.ts new file mode 100644 index 000000000..350f8c93e --- /dev/null +++ b/typings/tests/import-exports.types.ts @@ -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(codecept) +expectType(Codecept) +expectType(output) +expectType(event) +expectType(recorder) +expectType(config) +expectType(actor) +expectType(helper) +expectType(Helper) +expectType(pause) +expectType(within) +expectType(dataTable) +expectType(dataTableArgument) +expectType(store) +expectType(locator)