#mocha div missing

When i click on run tests it says " mocha div missing paste it in your document " can someone tell me what this is

Sounds like an internal error to the test (mocha is the test framework). How are you adding the test script? If it is on Codepen, can you link to the project?

Try re-adding the test to the page
<script src="https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js"></script>

1 Like

yea sure here : https://codepen.io/Rcrisp/pen/NZNwMP?editors=1100

I don’t get an error and you are passing all the tests. You can submit it.

If you want you can try moving the script to the Codepen settings. Click the Settings button, go to the JavaScript tab and paste the URL (not with the script tag just the URL) of the test script.

https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js.

Remember to remove the script from the HTML so you only have it in the settings.

1 Like

I get that all the time and then my tests never run. Once I put an empty div #mocha at the end of the body the tests run. It’s their mistake I just gotta roll with it.

PS I wonder if the FCC instructions and codepen template are older than codepen.io’s rewrite in react? :thinking:

2 Likes

I followed @lasjorg 's instructions to add the bunde.js to the codepen settings, removed the <script> line from my HTML, and then refreshed my browser. That fixed it.

Regardless of which technique you choose, the trick seems to be that you must refresh your browser after making the FCC recommended changes in order to load the bundle.js library into your codepen.

1 Like

Many many thanks!

Hi tlc35us

I am currently encountering this problem and have tried all available suggestions to no avail

With the div #mocha recommendation, did you use something like the following at the end of <body>?

<div id="mocha">
</div>

Thanks
Ray

Yeah it’s really strange. I’ve gotten better at using codepen.io. Now I make sure I sign in then fork and save it rename it and I seem to avoid the problem. If it persists then I just put it at the end so it’s out of my way. Don’t no why I just can’t edit and test as Captain Anonymous.

Go to browser cookie setting and turn off “Block third-parties cookies”
This worked for me