CodeceptJS icon indicating copy to clipboard operation
CodeceptJS copied to clipboard

Discrepancies between code documentation online and the NPM package

Open pooventhan opened this issue 3 years ago • 1 comments

Hi there! I noticed some discrepancies with the code documentation online and the NPM package. The web documentation says waitForVisible method returns a promise and the source file is an async method. However, the types.d.ts file (from the NPM package) says it is a void method.

Is it a bug in .d.ts file ?

image (17)

Details

  • CodeceptJS version: 3.2.3
  • NodeJS Version: v16.13.1
  • Operating System: Windows 10

pooventhan avatar Jun 01 '22 04:06 pooventhan

I guess so @pooventhan as this method doesn't return anything.

kobenguyent avatar Sep 13 '22 12:09 kobenguyent

This appears to be caused by various mustache templates having the wrong return type, i.e. void instead of Promise<void> such as: https://github.com/codeceptjs/CodeceptJS/blob/f598059451c6c54c7a49c31ff6b2958cde23ee4a/docs/webapi/amOnPage.mustache#L11

There are also dozens of mustache templates where a promise return type is documented in English, but not in JSDoc, such as: https://github.com/codeceptjs/CodeceptJS/blob/f598059451c6c54c7a49c31ff6b2958cde23ee4a/docs/webapi/scrollTo.mustache#L12

Would you like me to prepare a PR to fix this?

fwouts avatar Oct 26 '23 04:10 fwouts

This appears to be caused by various mustache templates having the wrong return type, i.e. void instead of Promise<void> such as:

https://github.com/codeceptjs/CodeceptJS/blob/f598059451c6c54c7a49c31ff6b2958cde23ee4a/docs/webapi/amOnPage.mustache#L11

There are also dozens of mustache templates where a promise return type is documented in English, but not in JSDoc, such as:

https://github.com/codeceptjs/CodeceptJS/blob/f598059451c6c54c7a49c31ff6b2958cde23ee4a/docs/webapi/scrollTo.mustache#L12

Would you like me to prepare a PR to fix this?

That'll be great @fwouts

kobenguyent avatar Oct 26 '23 06:10 kobenguyent