processing / p5.js

p5.js is a client-side JS platform that empowers artists, designers, students, and anyone to learn to code and express themselves creatively on the web. It is based on the core principles of Processing. http://twitter.com/p5xjs —
http://p5js.org/
GNU Lesser General Public License v2.1
21.66k stars 3.32k forks source link

Update Chai assertion library to the latest version #6690

Open lindapaiste opened 10 months ago

lindapaiste commented 10 months ago

Increasing Access

It would allow users to look at the Chai documentation and be able to use any assertions that they find there.

Most appropriate sub-area of p5.js?

Feature enhancement details

We are using chai version ^3.5.0 but we should update it to ^5.0.0.

I tried writing a unit test with assert.notExists() but I got an error that notExists isn't a function. Updating to the latest version will enable more types of assertions like this.

lindapaiste commented 10 months ago

On a related note, we say in the contributor docs

Similarly we can use assert.strictEqual(myp5.keyIsPressed, true) to assert if the value is true.

Personally I would use assert.isTrue(myp5.keyIsPressed) for that because I think it's better to use more specific assertions.

ayushanand308 commented 10 months ago

@lindapaiste I would like to have a go at it! Also, correct me if I am wrong but I think that latest release of chai is ^4.3.7

limzykenneth commented 10 months ago

The latest release is 5.0.0. If there are no breaking change affecting our tests, this can go ahead and be updated.

diyaayay commented 9 months ago

@ayushanand308 Are you working on this? I've too been looking to get some experience with unit tests, let me know if I can help or be a part of this issue in any way :)

mohitbalwani commented 9 months ago

I tried running tests with latest Chai version and found that most of tests were failing. I am curious about how should we proceed next? I am assuming that it will require manual investigation on failing tests and fixing them?

limzykenneth commented 9 months ago

If updating the version of Chai at this point is not very straightforward, I would suggest deferring it for now and focus on the 2.0 RFC at #6678 which proposes using Vitest to run the tests. Chai is bundled with Vitest (although we can use our own version if we really want to) so handling versions should not be an issue.