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

Return booleans indicating whether assertions passed #2696

Merged

Conversation

jmarkham828
Copy link
Contributor

@jmarkham828 jmarkham828 commented Feb 22, 2021

Apologies for dropping this. I just finished university! 🥳

Hoping to still contribute to this awesome project. I picked up where this left off. I totally understand if this PR is closed, given that I left it hanging for a while, but wanted to give it another go at resolving #2455, since it doesn't look like #2586 is active any longer.

@jmarkham828 jmarkham828 force-pushed the john-m/assertions-return-booleans branch 2 times, most recently from 4eeca1b to 555e500 Compare February 23, 2021 05:36
@jmarkham828
Copy link
Contributor Author

@novemberborn Getting an error like this:

Error: Error loading ava.config.js: Not supported
    at loadJsConfig (/Users/johnmarkham/Desktop/ava/lib/load-config.js:33:23)

when trying to lint the files or check types (xo, tsd) to get the build green. Have you seen something like this before? Also not quite sure how to diagnose the failing type tests.

@novemberborn
Copy link
Member

I don't see that XO error output in CI, maybe it's a case of outdated dependencies installed on your machine? There are a lot of other linting errors though.

There should be some easier to solve TypeScript errors, like SnapshotOptions being missing. A lot has changed recently, might just be that your older commits are trying to reintroduce some code that is no longer meant to be there.

@jmarkham828 jmarkham828 force-pushed the john-m/assertions-return-booleans branch from 555e500 to 9e85479 Compare February 24, 2021 22:20
@jmarkham828
Copy link
Contributor Author

@novemberborn thanks for getting back to me. Weird... I have no diff with any packages, and no diff with any configuration files for xo, yet always get an error loading ava.config.js or ava.config.mjs locally...

@jmarkham828
Copy link
Contributor Author

Nice. The solution was quite weird: I commented this out, then ran npx xo --fix <file> and it did the trick. Then even after uncommenting that line, xo did not throw an error anymore. Some weird setup bug maybe. 🤷

@jmarkham828 jmarkham828 changed the title [draft] feat: assertions return booleans feat: assertions return booleans Feb 25, 2021
index.d.ts Show resolved Hide resolved
@jmarkham828 jmarkham828 force-pushed the john-m/assertions-return-booleans branch from d5cf4bf to 68db1e6 Compare February 25, 2021 06:23
Normally throws() returns the error when it passes. Let's not change that.
The previous commit fixed the return-value assertions, catching this one.
@novemberborn
Copy link
Member

@jmarkham828 I've pushed some tweaks, notably in the tests to assert on the return values. The throws assertions shouldn't return booleans which I've also fixed.

Would you mind updating the documentation for the assertions that now return booleans?

@jmarkham828
Copy link
Contributor Author

jmarkham828 commented Mar 6, 2021

Thank you so much for the help, @novemberborn. 🙏

Separately, how could 64ad93e have caused the build to fail 🤔

@jmarkham828 jmarkham828 requested a review from novemberborn March 6, 2021 21:41
@novemberborn
Copy link
Member

Separately, how could 64ad93e have caused the build to fail 🤔

Just flakiness. A different run failed this time.

@novemberborn novemberborn changed the title feat: assertions return booleans Return booleans indicating whether assertions passed Mar 7, 2021
@novemberborn novemberborn merged commit 72a4e2f into avajs:main Mar 7, 2021
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.

2 participants