Skip to content

Commit d502d83

Browse files
committed
Fixes error messages and documentation
1 parent 9947e22 commit d502d83

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

contributor_docs/unit_testing.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,8 @@ When you add a new test, running `npm test` will generate new screenshots for an
141141
To manually inspect all visual tests, run `grunt yui:dev` to launch a local server, then go to http://127.0.0.1:9001/test/visual.html to see a list of all test cases.
142142
143143
144-
The visual test environment is set up to execute your commands sequentially rather than running a preload or draw function that you provide.
145-
In continuous integration (CI) environments, it's crucial to keep tests running as quickly as possible. Running a full `preload/draw` cycle as in a regular p5.js sketch can significantly slow down the testing process.
146-
When testing features like 3D model rendering, you might encounter scenarios where you need to load a model before performing assertions. Here's an example of how you can handle Sequential Command Execution and Asynchronous Operations in your visual tests:
147-
144+
In a continuous integration (CI) environment, optimizing test speed is essential. It is advantageous to keep the code concise, avoid unnecessary frames, minimize canvas size, and load assets only when essential for the specific functionality under test.
145+
To address scenarios involving operations like asynchronous 3D model rendering, consider returning a promise that resolves upon completing all the necessary tests, ensuring efficiency in your visual testing approach. Here's an example of how you can asynchronous 3D model rendering in your visual tests:
148146
149147
```js
150148
visualSuite('3D Model rendering', function() {

test/unit/visual/visualTest.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,8 @@ window.visualTest = function(
153153

154154

155155
if (actual.length === 0) {
156-
throw new Error('No screenshots were generated. Check if your test generates screenshots correctly.If the test includes asynchronous operations, ensure they complete before the test ends.');
156+
throw new Error('No screenshots were generated. Check if your test generates screenshots correctly. If the test includes asynchronous operations, ensure they complete before the test ends.');
157157
}
158-
159-
160158
if (expectedScreenshots && actual.length !== expectedScreenshots) {
161159
throw new Error(
162160
`Expected ${expectedScreenshots} screenshot(s) but generated ${actual.length}`

0 commit comments

Comments
 (0)