Skip to content

Commit 973a28f

Browse files
authored
fix #4848 TS types of methods (Feature|Scenario)Config.config (#4851)
1 parent 0b5c731 commit 973a28f

File tree

3 files changed

+30
-11
lines changed

3 files changed

+30
-11
lines changed

.github/CONTRIBUTING.md

+9-7
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Go over the steps in [this](https://github.com/firstcontributions/first-contribu
77
To start you need:
88

99
1. Fork and clone the repo.
10-
2. Run `npm i --force --omit=optional` to install all required libraries
10+
2. Run `npm i --force` to install all required libraries
1111
3. Do the changes.
1212
4. Add/Update Test (if possible)
1313
5. Update documentation
@@ -28,7 +28,6 @@ To run examples:
2828
node bin/codecept.js run -c examples
2929
```
3030

31-
3231
Depending on a type of change you should do the following.
3332

3433
## Debugging
@@ -45,12 +44,12 @@ Please keep in mind that CodeceptJS have **unified API** for Playwright, WebDriv
4544

4645
### Updating Playwright | Puppeteer | WebDriver
4746

48-
*Whenever a new method or new behavior is added it should be documented in a docblock. Valid JS-example is required! Do **not edit** `docs/helpers/`, those files are generated from docblocks in corresponding helpers! *
47+
_Whenever a new method or new behavior is added it should be documented in a docblock. Valid JS-example is required! Do **not edit** `docs/helpers/`, those files are generated from docblocks in corresponding helpers! _
4948

5049
Working test is highly appreciated. To run the test suite you need:
5150

52-
* selenium server + chromedriver
53-
* PHP installed
51+
- selenium server + chromedriver
52+
- PHP installed
5453

5554
To launch PHP demo application run:
5655

@@ -83,7 +82,7 @@ http://localhost:8000/form/myexample
8382

8483
### Updating REST | ApiDataFactory
8584

86-
*Whenever a new method or new behavior is added it should be documented in a docblock. Valid JS-example is required!*
85+
_Whenever a new method or new behavior is added it should be documented in a docblock. Valid JS-example is required!_
8786

8887
Adding a test is highly appreciated.
8988

@@ -97,7 +96,7 @@ Edit a test at `test/rest/REST_test.js` or `test/rest/ApiDataFactory_test.js`
9796

9897
## Appium
9998

100-
*Whenever a new method or new behavior is added it should be documented in a docblock. Valid JS-example is required! Do **not edit** `docs/helpers/`, those files are generated from docblocks in corresponding helpers! *
99+
_Whenever a new method or new behavior is added it should be documented in a docblock. Valid JS-example is required! Do **not edit** `docs/helpers/`, those files are generated from docblocks in corresponding helpers! _
101100

102101
It is recommended to run mobile tests on CI.
103102
So do the changes, make pull request, see the CI status.
@@ -212,6 +211,7 @@ docker-compose run --rm test-helpers test/rest
212211
```
213212

214213
#### Run acceptance tests
214+
215215
To that we provide three separate services respectively for WebDriver, Nightmare and Puppeteer tests:
216216

217217
```sh
@@ -236,11 +236,13 @@ And now every command based on `test-helpers` service will use node 9.4.0. The
236236
same argument can be passed when building unit and acceptance tests services.
237237

238238
### CI flow
239+
239240
We're currently using a bunch of CI services to build and test codecept in
240241
different environments. Here's short summary of what are differences between
241242
separate services
242243

243244
#### CircleCI
245+
244246
Here we use CodeceptJS docker image to build and execute tests inside it. We
245247
start with building Docker container based on Dockerfile present in main project
246248
directory. Then we run (in this order) unit tests, all helpers present in

lib/mocha/featureConfig.js

+11-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
* Can inject values and add custom configuration.
44
*/
55
class FeatureConfig {
6+
/**
7+
* @param {CodeceptJS.Suite} suite
8+
*/
69
constructor(suite) {
710
this.suite = suite
811
}
@@ -41,12 +44,17 @@ class FeatureConfig {
4144
return this
4245
}
4346

47+
/**
48+
* @callback FeatureConfigCallback
49+
* @param {CodeceptJS.Suite} suite
50+
* @returns {Object<string, any>}
51+
*/
52+
4453
/**
4554
* Configures a helper.
4655
* Helper name can be omitted and values will be applied to first helper.
47-
*
48-
* @param {string|number} helper
49-
* @param {*} obj
56+
* @param {string | Object<string, any> | FeatureConfigCallback} helper
57+
* @param {Object<string, any>} [obj]
5058
* @returns {this}
5159
*/
5260
config(helper, obj) {

lib/mocha/scenarioConfig.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ const { isAsyncFunction } = require('../utils')
22

33
/** @class */
44
class ScenarioConfig {
5+
/**
6+
* @param {CodeceptJS.Test} test
7+
*/
58
constructor(test) {
69
this.test = test
710
}
@@ -77,10 +80,16 @@ class ScenarioConfig {
7780
return this
7881
}
7982

83+
/**
84+
* @callback ScenarioConfigCallback
85+
* @param {CodeceptJS.Test} test
86+
* @returns {Object<string, any>}
87+
*/
88+
8089
/**
8190
* Configures a helper.
8291
* Helper name can be omitted and values will be applied to first helper.
83-
* @param {string | Object<string, any>} helper
92+
* @param {string | Object<string, any> | ScenarioConfigCallback} helper
8493
* @param {Object<string, any>} [obj]
8594
* @returns {this}
8695
*/

0 commit comments

Comments
 (0)