Skip to content

Commit 5a69086

Browse files
committed
fix codeceptjs#4848 TS types of methods (Feature|Scenario)Config.config
1 parent 3a60718 commit 5a69086

File tree

3 files changed

+34
-14
lines changed

3 files changed

+34
-14
lines changed

.github/CONTRIBUTING.md

+13-10
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ 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
14-
6. Run `npm run docs` if you change the documentation
15-
7. Commit and Push to your fork
16-
8. Make Pull Request
14+
6. Run `npm run def` if you changed the type definitions
15+
7. Run `npm run docs` if you changed the documentation
16+
8. Commit and Push to your fork
17+
9. Make Pull Request
1718

1819
To run codeceptjs from this repo use:
1920

@@ -27,7 +28,6 @@ To run examples:
2728
node bin/codecept.js run -c examples
2829
```
2930

30-
3131
Depending on a type of change you should do the following.
3232

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

4545
### Updating Playwright | Puppeteer | WebDriver
4646

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! *
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! _
4848

4949
Working test is highly appreciated. To run the test suite you need:
5050

51-
* selenium server + chromedriver
52-
* PHP installed
51+
- selenium server + chromedriver
52+
- PHP installed
5353

5454
To launch PHP demo application run:
5555

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

8383
### Updating REST | ApiDataFactory
8484

85-
*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!_
8686

8787
Adding a test is highly appreciated.
8888

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

9797
## Appium
9898

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! *
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! _
100100

101101
It is recommended to run mobile tests on CI.
102102
So do the changes, make pull request, see the CI status.
@@ -211,6 +211,7 @@ docker-compose run --rm test-helpers test/rest
211211
```
212212

213213
#### Run acceptance tests
214+
214215
To that we provide three separate services respectively for WebDriver, Nightmare and Puppeteer tests:
215216

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

237238
### CI flow
239+
238240
We're currently using a bunch of CI services to build and test codecept in
239241
different environments. Here's short summary of what are differences between
240242
separate services
241243

242244
#### CircleCI
245+
243246
Here we use CodeceptJS docker image to build and execute tests inside it. We
244247
start with building Docker container based on Dockerfile present in main project
245248
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)