The Wayback Machine - https://web.archive.org/web/20200711023218/https://github.com/avajs/ava/issues/2455
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

Have assertions return booleans #2455

Open
novemberborn opened this issue Apr 14, 2020 · 12 comments
Open

Have assertions return booleans #2455

novemberborn opened this issue Apr 14, 2020 · 12 comments

Comments

@novemberborn
Copy link
Member

@novemberborn novemberborn commented Apr 14, 2020

Spurred by conversation in #2449 and #1485 we'd like for our assertions to return booleans. true when they pass, false when they fail. This does not apply to the throws() and throwsAsync() assertions.

Failing assertions will fail the test, but do not throw exceptions. This means your test does not stop executing. Usually that's fine, but there are conditions where you're about to do something that uses a lot of resources, and it's already unnecessary. Returning booleans will help with this.

The assertions are defined here:

class Assertions {

The type definition should be updated to reflect the new return type:

ava/index.d.ts

Line 41 in 18aeac6

export interface Assertions {

Some tests should be added to (or existing test updated in) https://github.com/avajs/ava/blob/master/test-tap/assert.js.

@aviralch
Copy link

@aviralch aviralch commented Apr 16, 2020

Hello,

can i work on this ?

@novemberborn
Copy link
Member Author

@novemberborn novemberborn commented Apr 17, 2020

@aviralch yea that'd be great, thanks!

@pmascheroni
Copy link

@pmascheroni pmascheroni commented Apr 18, 2020

Hi, @novemberborn I am also attempting an update to this issue and wondering if I could be assigned to it too? Not sure if that is allowed, but I would like to work on this also.

Thanks

@novemberborn
Copy link
Member Author

@novemberborn novemberborn commented Apr 19, 2020

@pmascheroni let's give @aviralch a chance first.

@aviralch
Copy link

@aviralch aviralch commented Apr 19, 2020

@novemberborn, @pmascheroni this is my first issue, I will try to do this and keep you updated by the end of of week.

@BARICISSE
Copy link

@BARICISSE BARICISSE commented May 11, 2020

Hi, if no one is currently working on this and it is still open, i would like to contribute.

@novemberborn
Copy link
Member Author

@novemberborn novemberborn commented May 12, 2020

@aviralch what do you think?

@aviralch
Copy link

@aviralch aviralch commented May 12, 2020

Yup, sure go ahead. I am currently in middle of exams but if you need to get in touch lmk.

@novemberborn
Copy link
Member Author

@novemberborn novemberborn commented May 12, 2020

Thank you @aviralch, and good luck!

@RahulKannan12
Copy link

@RahulKannan12 RahulKannan12 commented May 16, 2020

Hi, is it done ?, if not I can make a try ! Please let me know 👍 I would like to contribute

@BARICISSE
Copy link

@BARICISSE BARICISSE commented May 16, 2020

Hi @RahulKannan12, I am currently working on it.

@RahulKannan12
Copy link

@RahulKannan12 RahulKannan12 commented May 17, 2020

Hi @BARICISSE , Okay great ! thanks for the information 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.