Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Eduardo Diaz
PLUS
Eduardo Diaz
Courses Plus Student 6,048 Points

Setup for firefox

How can i setup firefox to debug node js apps ? in chrome when i use node --inspect-brk ./node_modules/.bin/_mocha/ i can debug the tests, however i cant find a way to debug them in firefox ?

1 Answer

Dane Parchment
MOD
Dane Parchment
Treehouse Moderator 11,077 Points

Create an index.html and call your scripts in it, and then output in an element on the page.

I don't have time to show you the code for this, but all you need to do is import the scripts and the tests via <script> tags and then create an element <div id="mocha"> that you will use as the container for your test output!

EDIT: Here is some code

<!DOCTYPE html>
<html>
  <head>
    <title>Mocha Tests</title>
    <link rel="stylesheet" href="node_modules/mocha/mocha.css">
  </head>
  <body>
    <div id="mocha"></div>
    <script src="node_modules/mocha/mocha.js"></script>
    <script src="node_modules/chai/chai.js"></script>
    <script>mocha.setup('bdd')</script>

    <!-- load code you want to test here -->

    <!-- load your test files here -->

    <script>
      mocha.run();
    </script>
  </body>
</html>