Skip to content

test: improve shared helpers #2362

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

Merged
merged 17 commits into from
May 13, 2020
Merged

test: improve shared helpers #2362

merged 17 commits into from
May 13, 2020

Conversation

emadum
Copy link
Contributor

@emadum emadum commented May 10, 2020

Description

NODE-2605

What changed?

  • remove withTempDb
  • make client argument of withClient optional
  • move unexported top-level function makeCleanupFn into withClient
  • remove connectToDb helper
  • add filter function to filterForCommands/filterOutCommands/withMonitoredClient
  • alphabetize helpers in shared.js

Also introduced some CI-related cleanup:

  • output eslint version before linting
  • upgrade nvm and use --no-progress option to clean up log output

Are there any files to ignore?

@emadum emadum changed the title refactor: improve shared helpers test: improve shared helpers May 10, 2020
@emadum emadum marked this pull request as ready for review May 11, 2020 17:00
@emadum emadum requested review from mbroadst and reggi May 11, 2020 17:00
Copy link
Contributor

@reggi reggi left a comment

Choose a reason for hiding this comment

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

LGTM, Makes testing easier +++++

@emadum
Copy link
Contributor Author

emadum commented May 12, 2020

LGTM, Makes testing easier +++++

@reggi Made some more changes after you reviewed - re-requesting. Might be easiest to just check the new commits. Sorry about that!

@emadum emadum requested a review from reggi May 12, 2020 19:42
@emadum emadum requested a review from mbroadst May 13, 2020 11:24
Copy link
Member

@mbroadst mbroadst left a comment

Choose a reason for hiding this comment

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

one little nit you can take or leave, but otherwise LGTM! Great refactor on withClient here, I think it's really evolving into something we'd want to use everywhere

const withClient = require('./shared').withClient;
const withMonitoredClient = require('./shared').withMonitoredClient;
const shared = require('./shared');
const { withClient, withMonitoredClient } = shared;
Copy link
Member

Choose a reason for hiding this comment

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

if we're destructuring anyway it looks like just about all of these come from shared:

const {
  withClient,
  withMonitoredClient,
  assert,
  setupDatabase
} = require('./shared');

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mbroadst I updated a few things since your review, can you take a look when you get a chance? Refactoring withMonitoredClient exposed an issue in withClient, where it was swallowing errors returned by the done(err) callback in tests. I've updated withClient to now throw those errors after cleanup.

@mbroadst mbroadst self-requested a review May 13, 2020 20:56
Copy link
Contributor

@reggi reggi left a comment

Choose a reason for hiding this comment

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

LGTM Loving the quality of life changes here, making it easier to test! 🥳

@emadum emadum merged commit 96d2ca6 into master May 13, 2020
@emadum emadum deleted the NODE-2605/refactor-shared-helpers branch May 13, 2020 21:16
@emadum emadum restored the NODE-2605/refactor-shared-helpers branch May 13, 2020 22:00
@emadum emadum deleted the NODE-2605/refactor-shared-helpers branch May 13, 2020 22:01
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.

3 participants