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

clean up assert exports #1729

Merged
merged 3 commits into from
Aug 23, 2023
Merged

clean up assert exports #1729

merged 3 commits into from
Aug 23, 2023

Conversation

turadg
Copy link
Member

@turadg turadg commented Aug 22, 2023

refs: #1717

Description

Fewer exports per #1717 (comment)
Clearer names per #1717 (comment)

Security Considerations

Scaling Considerations

Documentation Considerations

These are breaking changes to master, but not to what's been published.

Testing Considerations

Upgrade Considerations

@turadg turadg changed the title ta/assert exports clean up assert exports Aug 22, 2023
string: assertString,
typeof: assertTypeof,
} = globalAssert;
const { bare, details, error, Fail, note, quote, makeAssert } = globalAssert;
Copy link
Contributor

Choose a reason for hiding this comment

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

I thought part of the consensus was to have the assert exported by this package contain only the assertions, i.e., the methods not separately exported by name.

Suggested change
const { bare, details, error, Fail, note, quote, makeAssert } = globalAssert;
const { bare, details, error, Fail, note, quote, makeAssert, ...assertions } = globalAssert;
Object.freeze(assertions);
export { assertions as assert };

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, I forgot to include that change.

Copy link
Member

Choose a reason for hiding this comment

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

And the exported assert needs to be callable as well.

const { bare, details: redacted, error, Fail: throwRedacted, note, quote,  makeAssert, ...assertions } = globalAssert;
const assert = (...args) => globalAssert(...args);
Object.assign(assert, assertions);
export { assert, redacted, throwRedacted, quote, bare, note, makeAssert };

Copy link
Contributor

@erights erights left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@turadg turadg merged commit 199290e into master Aug 23, 2023
13 checks passed
@turadg turadg deleted the ta/assert-exports branch August 23, 2023 02:41
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