Skip to content
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

Address deprecation warning in Unit Tests #2267

Merged
merged 1 commit into from
Mar 23, 2023

Conversation

michael-lloyd-morris
Copy link
Contributor

@michael-lloyd-morris michael-lloyd-morris commented Mar 22, 2023

πŸ€” What's changed?

Fixing a deprecation warning in the unit tests.

> mocha 'src/**/*_spec.ts'



  ........(node:38244) [DEP0147] DeprecationWarning: In future versions of Node.js, fs.rmdir(path, { recursive: true }) will be removed. Use fs.rm(path, { recursive: true }) instead
(Use `node --trace-deprecation ...` to show where the warning was created)
...........................................................................................................
  ...................................................................................................................
  ................................................................................................

  326 passing (4s)

⚑️ What's your motivation?

Bugfix - well, a potential bug when the Node team finally follows up on the deprecation.

🏷️ What kind of change is this?

  • πŸ› Bug fix (non-breaking change which fixes a defect)

πŸ“‹ Checklist:

  • I agree to respect and uphold the Cucumber Community Code of Conduct
  • I've changed the behaviour of the code
    • I have added/updated tests to cover my changes.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.
  • Users should know about my change
    • I have added an entry to the "Unreleased" section of the CHANGELOG, linking to this pull request.

@@ -32,6 +32,9 @@ export async function setupEnvironment(): Promise<Partial<IRunEnvironment>> {
}

export async function teardownEnvironment(environment: IRunEnvironment) {
await fs.rmdir(environment.cwd, { recursive: true })
environment.stdout.end()
return new Promise((resolve) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Apparently mz/fs doesn't have the new version of fs.rm in its implementation - that or it's incompatible with the old one the deprecation warns about. In any event, to resolve the deprecation I had to resort to the older Promise.then pattern.

@coveralls
Copy link

Coverage Status

Coverage: 98.561% (+0.0006%) from 98.561% when pulling 3b94338 on michael-lloyd-morris:fixDeprecation into 627030d on cucumber:main.

@davidjgoss davidjgoss merged commit f59ea9f into cucumber:main Mar 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants