Skip to content

Commit aed3123

Browse files
authored
fixed: TS typings for Codecept and MainConfig (#5216)
1 parent db7d0fc commit aed3123

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

lib/codecept.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,14 +122,16 @@ class Codecept {
122122
/**
123123
* Executes bootstrap.
124124
*
125+
* @returns {Promise<void>}
125126
*/
126127
async bootstrap() {
127128
return runHook(this.config.bootstrap, 'bootstrap')
128129
}
129130

130131
/**
131132
* Executes teardown.
132-
133+
*
134+
* @returns {Promise<void>}
133135
*/
134136
async teardown() {
135137
return runHook(this.config.teardown, 'teardown')
@@ -262,6 +264,11 @@ class Codecept {
262264
})
263265
}
264266

267+
/**
268+
* Returns the version string of CodeceptJS.
269+
*
270+
* @returns {string} The version string.
271+
*/
265272
static version() {
266273
return JSON.parse(readFileSync(`${__dirname}/../package.json`, 'utf8')).version
267274
}

typings/index.d.ts

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ declare namespace CodeceptJS {
9797
* tests: 'tests/**.test.ts'
9898
* ```
9999
*/
100-
tests: string
100+
tests: string | string[]
101101
/**
102102
* Where to store failure screenshots, artifacts, etc
103103
*
@@ -520,17 +520,16 @@ declare namespace CodeceptJS {
520520
}
521521
}
522522

523-
type TryTo = <T>(fn: () => Promise<T> | T) => Promise<T | false>;
524-
type HopeThat = <T>(fn: () => Promise<T> | T) => Promise<T | false>;
525-
type RetryTo = <T>(fn: () => Promise<T> | T, retries?: number) => Promise<T>;
526-
523+
type TryTo = <T>(fn: () => Promise<T> | T) => Promise<T | false>
524+
type HopeThat = <T>(fn: () => Promise<T> | T) => Promise<T | false>
525+
type RetryTo = <T>(fn: () => Promise<T> | T, retries?: number) => Promise<T>
527526

528527
// Globals
529528
declare const codecept_dir: string
530529
declare const output_dir: string
531-
declare const tryTo: TryTo;
532-
declare const retryTo: RetryTo;
533-
declare const hopeThat: HopeThat;
530+
declare const tryTo: TryTo
531+
declare const retryTo: RetryTo
532+
declare const hopeThat: HopeThat
534533

535534
declare const actor: CodeceptJS.actor
536535
declare const codecept_actor: CodeceptJS.actor
@@ -643,7 +642,7 @@ declare module '@codeceptjs/helper' {
643642
}
644643

645644
declare module 'codeceptjs/effects' {
646-
export const tryTo: TryTo;
647-
export const retryTo: RetryTo;
648-
export const hopeThat: HopeThat;
645+
export const tryTo: TryTo
646+
export const retryTo: RetryTo
647+
export const hopeThat: HopeThat
649648
}

0 commit comments

Comments
 (0)