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

feature: Add assertionWithLazyOperator #18

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

hamza0867
Copy link

Closes #17

@@ -70,13 +70,7 @@ if (globsOrNames.some((item) => item.includes("*"))) {
globsOrNames.map(
(globOrName) =>
new Promise((resolve, reject) => {
glob(globOrName, (err, files) => {
Copy link
Author

Choose a reason for hiding this comment

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

Apparently this callback variant does not exist anymore in the version 10.3.10 (cf: https://github.com/isaacs/node-glob?tab=readme-ov-file#globpattern-string--string-options-globoptions--promisestring--path ). Only promise and sync options exist.

Copy link

Choose a reason for hiding this comment

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

just posted this in the issues: #19 maybe should have checked PR first

@bloodyowl
Copy link
Owner

the operator parameter is just the string description of the the operator, in what case is it heavy to compute?

@hamza0867
Copy link
Author

the operator parameter is just the string description of the the operator, in what case is it heavy to compute?

The thing is, the operator is shown in case of error, which can be used to display custom error messages, those error messages can be heavy to compute. For example when we want to display some formatted message that is generated by going through some deep tree and collecting data from the tree.

@TheSpyder
Copy link

For context, we're replacing some ounit2 code, there the assertion can include both a string message and a printer function.
https://dsheets.github.io/codoc/ounit.2.0.0/_build/src/oUnit2/index.html#/val:assert_equal

We use the printer function because we are working with a document model; the simple object diff doesn't provide enough context for changes deep in the tree. In the absence of a printer function, we have to render those details into the string description which can be expensive.

Would you rather we add an assertion with a printer function?

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.

Add an assertion with a lazy operator
4 participants