You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The text was updated successfully, but these errors were encountered:
justinbc820
changed the title
Tutorial shows invalid function type passed to before block
Readme shows invalid function type passed to before block (functional tests)
Nov 21, 2017
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>.
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
The text was updated successfully, but these errors were encountered: