Skip to content

Issue with Build A Sorting Visualizer challenge and test runner #67808

@diegoc83

Description

@diegoc83

Describe the Issue

Hi,

I have been coming around on how to get all test to pass in the challenge called "Build A Sorting Visualizer" (JS)

In fact, at first sight the code implemented seems to sort and display the solution in the right way.

But the real issue comes when REPEATED and ONGOING requests are made to the application. This can be checked on the right display window too.
In fact, when many requests are made, even over a FIXED ARRAY (for debugging purposes) the next events happen:

- Some iterations show the same result. Some fail, and then back to show the right output, etc (for the SAME FIXED ARRAY)
- When the output fails, these issues happen: some div items are not shown, either final result remains blank or some random numbers show as NaN

When the tests run, the only to fail are 18 and 19 (relative to the right output shown on the HTML)
Only these tests fail.

I have also guessed that the method Math.random() to achieve multiple iterating Random Numbers is inappropriate to make multiple ITERATIVE calls.
I tried using the Uint32Array class iplementation, which is optimized using the crypto.getRandomValues method to achieve the same.
In this case the test 18 passed only (not 19), but this also needs the reload of the challenge page to remain passing.

Also in such latest case tests 2 and 5 fail (related to detecting the Random Numbers), though the output seems to be right.
Also in this latest situation, iterative calls seem to display the same issues on the right panel which were described first.

Regarding this issue, I have been told by the freeCodeCamp team to post about it as accurately as possible, in order to the fixes be sorted out if necessary.

I hope that you are able to do the necessary fixes. Thanks

Regards,

Affected Page

https://www.freecodecamp.org/learn/javascript-v9/lab-sorting-visualizer/build-a-sorting-visualizer

Your code




Expected behavior

Tests 18 and 19 should be passing, though iterative calls (and tests runned multiple times) seem to affect the right HTML display. Guessed also due to collisions using Math.random()

Screenshots

FIXED ARRAY iterations show nice output, then back to lack of divs on display, etc.
Other calls show NaN where Random Numbers should be displayed

https://github.com/user-attachments/assets/23a60fab-bc96-4c30-afca-8c991a3d1242
https://github.com/user-attachments/assets/77333b63-ea3b-499b-8c22-413f1e1b803e
https://github.com/user-attachments/assets/2e403db7-76a0-49b1-9af7-bfafd251fd5c
https://github.com/user-attachments/assets/add1ca77-5af3-47c3-ae3c-534409076a5f
https://github.com/user-attachments/assets/9acb2d8d-2040-48f5-876a-7771d7a5e9a1
https://github.com/user-attachments/assets/451f130d-e62f-4b5b-9e10-c0e3ca0a526e

System

  • Device: [Laptop]
  • OS: [Windows 11]
  • Browser: [Chrome]
  • Version: []

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    js v9 certThis is for the JS V9 certification.scope: curriculumLessons, Challenges, Projects and other Curricular Content in curriculum directory.status: waiting updateIs awaiting update, after feedback or request for changes

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions