Skip to content
Merged
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
9 changes: 8 additions & 1 deletion lib/codecept.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,16 @@ class Codecept {
/**
* Executes bootstrap.
*
* @returns {Promise<void>}
*/
async bootstrap() {
return runHook(this.config.bootstrap, 'bootstrap')
}

/**
* Executes teardown.

*
* @returns {Promise<void>}
*/
async teardown() {
return runHook(this.config.teardown, 'teardown')
Expand Down Expand Up @@ -262,6 +264,11 @@ class Codecept {
})
}

/**
* Returns the version string of CodeceptJS.
*
* @returns {string} The version string.
*/
static version() {
return JSON.parse(readFileSync(`${__dirname}/../package.json`, 'utf8')).version
}
Expand Down
21 changes: 10 additions & 11 deletions typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ declare namespace CodeceptJS {
* tests: 'tests/**.test.ts'
* ```
*/
tests: string
tests: string | string[]
/**
* Where to store failure screenshots, artifacts, etc
*
Expand Down Expand Up @@ -520,17 +520,16 @@ declare namespace CodeceptJS {
}
}

type TryTo = <T>(fn: () => Promise<T> | T) => Promise<T | false>;
type HopeThat = <T>(fn: () => Promise<T> | T) => Promise<T | false>;
type RetryTo = <T>(fn: () => Promise<T> | T, retries?: number) => Promise<T>;

type TryTo = <T>(fn: () => Promise<T> | T) => Promise<T | false>
type HopeThat = <T>(fn: () => Promise<T> | T) => Promise<T | false>
type RetryTo = <T>(fn: () => Promise<T> | T, retries?: number) => Promise<T>

// 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 tryTo: TryTo
declare const retryTo: RetryTo
declare const hopeThat: HopeThat

declare const actor: CodeceptJS.actor
declare const codecept_actor: CodeceptJS.actor
Expand Down Expand Up @@ -643,7 +642,7 @@ declare module '@codeceptjs/helper' {
}

declare module 'codeceptjs/effects' {
export const tryTo: TryTo;
export const retryTo: RetryTo;
export const hopeThat: HopeThat;
export const tryTo: TryTo
export const retryTo: RetryTo
export const hopeThat: HopeThat
}