Open justinbc820 opened 6 years ago
Hmm...this is actually a bug (or at least an inconvenience) in the Intern typings. SuiteLifeCycleFunction
shouldn't care about the resolution type of a Promise. findDisplayedByCssSelector
returns essentially a PromiseLike<Element>
which should be fine; all Intern really cares about is whether or not the return type is a PromiseLike so it knows whether to wait for it to resolve. However, the current typings explicitly expect a PromiseLike<void>
.
I created https://github.com/theintern/intern/issues/845 to track this.
This slipped through before because the completed tutorial uses async/await rather than explicitly returning a Command chain. Since no value is explicitly returned in the async/await version of the test, the function implicitly returns a PromiseLike<void>
.
Once a new version of Intern is published (likely 4.1.3), the tutorial will be updated to use it. Until then, using await
or tacking a .end()
or .then(() => {})
to the end of a Command chain will make TS happy.
Expected behavior
In the Readme, the before block in a functional suite should take a SuiteLifecycleFunction, which returns PromiseLike.
Current behavior
The readme shows the function passed to the before block returning Promise<Command, any>.
Possible solution
Steps to reproduce (for bugs)
no steps, just look in the readme. Typescript just complains about the wrong type being returned.
Environment
Example (e.g., dojo, backbone, etc.): Intern version: Node version: NPM version: Browser version:
Additional information