Skip to content

Updating visual tests docs for 2.x versions #7827

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

Open
wants to merge 6 commits into
base: dev-2.0
Choose a base branch
from

Conversation

perminder-17
Copy link
Collaborator

@perminder-17 perminder-17 commented May 17, 2025

Fixing docs for unit/visual testings.

@perminder-17 perminder-17 marked this pull request as ready for review June 2, 2025 21:45
@perminder-17
Copy link
Collaborator Author

Hi @davepagurek @ksen0, while reviewing unit_testing.md I noticed it still says we “use Mocha” and that we “import Chai for assertions.” In the dev-2.0 branch the runner is now Vitest, which exposes Mocha-style globals and bundles Chai internally. Is my docs technically correct for that part? I was little confused with it. Thanks :)

@perminder-17 perminder-17 requested review from davepagurek and ksen0 June 2, 2025 21:57
@@ -182,10 +186,9 @@ Here are the conventions and best practices that p5.js uses for unit tests which

## Running tests

The most straightforward way to run the tests is by using the `npm test` command in your terminal. However, `npm test` usually takes a long time to run simply because of the large number of test cases p5.js has. It can also sometimes be a bit repetitive to make some changes, run `npm test`, make some more changes, and run `npm test` again. Here are some tricks that can help streamline this process:
The most straightforward way to run the tests is by using the `npm test` command in your terminal. However, `npm test` usually takes a long time to run simply because of the large number of test cases p5.js has. We don’t need to run `npm test` over and over after each change. As soon as we save our code, we can see in the browser or terminal whether the tests pass or not.
Copy link
Member

Choose a reason for hiding this comment

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

Minor/optional: maybe screenshots of what the terminal / other tests windows look like when they're open? The below docs (205:209) could also reference this diagram.

@@ -217,13 +224,11 @@ visualTest('2D objects maintain correct size', function(p5, screenshot) {
});
```

If you need to add a new test file, add it to that folder, then add the filename to the list in `test/visual/visualTestList.js`. Additionally, if you want that file to be run automatically as part of continuous integration on every pull request, add the filename to the `visual` list in `test/unit/spec.js`.
No manual registration necessary. Any file placed in `test/unit/visual/cases` is auto-discovered by Vitest.
Copy link
Member

Choose a reason for hiding this comment

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

Minor: "To add a new test file, place it into test/unit/visual/cases. This will be auto-discovered by Vitest - no manual registration needed."

@perminder-17 perminder-17 linked an issue Jun 3, 2025 that may be closed by this pull request
17 tasks
@perminder-17
Copy link
Collaborator Author

Thanks @ksen0 , I can work on your suggestion asap. :)

@perminder-17 perminder-17 requested a review from ksen0 June 7, 2025 02:43
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.

Visual Testing Documentation Mismatch
2 participants