-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Fix(DeprecationWarning): Work around in testRunner #44925
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -209,8 +209,14 @@ namespace Harness.Parallel.Worker { | |||
const errors: ErrorInfo[] = []; | |||
const passes: TestInfo[] = []; | |||
const start = +new Date(); | |||
const runner = new Mocha.Runner(suite, /*delay*/ false); | |||
|
|||
/* DeprecationWarning: "Runner(suite: Suite, delay: boolean)" is deprecated. Use "Runner(suite: Suite, {delay: boolean})" instead.*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Temporary work around because Mocha Type Definition is not up to date
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW I ran npm i @types/mocha@latest
locally and it was updated to a version that has RunnerOptions | boolean
. So this workaround shouldn't be necessary anymore @Luxcium 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I'll close this then.
Signed-off-by: Benjamin Vincent (Luxcium) <luxcium@neb401.com>
Signed-off-by: Benjamin Vincent (Luxcium) <luxcium@neb401.com>
|
How hard would it be to update mocha's types to 9.0? There are almost 3,000 lines of types, so it might be prohibitively difficult. On the other hand, maybe |
I have annotated both Mocha constructor and the type library in my review of my PR... Oups ok I should probably consider looking in the Mocha 8. to see if it could be compatible and updated in the type 8.x |
In Mocha the constructor was updated here on line 127/129 From Therefore as @sandersn suggested this is something that should be first fixed in the type definition... and then this issue could be resolved without using a « workaround » The @type/mocha related to this issue is located here on line 1403 ― Originally posted by @Luxcium in #44922 (comment) ― and posted in (DefinitelyTyped/DefinitelyTyped#54416) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'd prefer // @ts-expect-error
instead of a cast, because we'll be forced to fix it when mocha@9 gets types.
The explanation is good though.
DeprecationWarning: "Runner(suite: Suite, delay: boolean)" is deprecated. Use "Runner(suite: Suite, {delay: boolean})" instead.
fixes #44922
@sandersn
Signed-off-by: Benjamin Vincent (Luxcium) luxcium@neb401.com
Please verify that:
Backlog
milestone (required)main
branchgulp runtests
locallygulp tests
&gulp runtests-parallel --light=false
locally