Skip to content

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

Closed
wants to merge 3 commits into from
Closed

Fix(DeprecationWarning): Work around in testRunner #44925

wants to merge 3 commits into from

Conversation

Luxcium
Copy link

@Luxcium Luxcium commented Jul 7, 2021

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:

  • There is an associated issue in the Backlog milestone (required)
  • Code is up-to-date with the main branch
  • You've successfully run gulp runtests locally
  • You've successfully run gulp tests & gulp runtests-parallel --light=false locally
  • There are new or updated unit tests validating the change
  • fixes DeprecationWarning: in testRunner  #44922

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>
@typescript-bot typescript-bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Jul 7, 2021
@@ -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.*/
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

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 👍

Copy link
Member

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.

Luxcium added 2 commits July 7, 2021 08:51
Signed-off-by: Benjamin Vincent (Luxcium) <luxcium@neb401.com>
Signed-off-by: Benjamin Vincent (Luxcium) <luxcium@neb401.com>
@Luxcium
Copy link
Author

Luxcium commented Jul 7, 2021

@sandersn

  • There is NO associated issue in the Backlog milestone (required)...
  • I do not think it is expected to have test suit for the test suit runner...

@Luxcium Luxcium mentioned this pull request Jul 7, 2021
5 tasks
@sandersn sandersn added the Housekeeping Housekeeping PRs label Jul 7, 2021
@sandersn
Copy link
Member

sandersn commented Jul 7, 2021

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 { delay: boolean } is in 8.* too?

@Luxcium
Copy link
Author

Luxcium commented Jul 7, 2021

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

@Luxcium
Copy link
Author

Luxcium commented Jul 10, 2021

In Mocha the constructor was updated here on line 127/129

From function Runner(suite, delay) to function Runner(suite, opts)
which was around version 7.1.0

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)

@Luxcium Luxcium marked this pull request as ready for review August 16, 2021 17:56
Copy link
Member

@sandersn sandersn left a 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.

@sandersn sandersn self-assigned this Feb 19, 2022
@sandersn sandersn closed this Feb 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For Uncommitted Bug PR for untriaged, rejected, closed or missing bug Housekeeping Housekeeping PRs
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

DeprecationWarning: in testRunner
4 participants