Mocha Tests Not Showing Up
<p>I am working through <em>Web Development with Node &amp; Express</em>, Chapter 5 (Quality Assurance). I have set up Mocha and Chai, but the tests are not showing up, even when I add the ?tests=1 onto the url.</p>

<p>meadowlark.js (main entry point):</p>

<pre><code>var express = require('express');
var app = express();
var handlebars = require('express-handlebars').create({ defaultLayout: 'main' });

// express handles normalizing url

app.set('port', process.env.PORT || 3000);
app.engine('handlebars', handlebars.engine);
app.set('view engine', 'handlebars');
app.use(express.static(__dirname + '/public'));

app.use(function(req, res, next) {
   res.locals.showTests = app.get('env') !== 'production' &amp;&amp; req.query.text === '1';
   next();
});

app.get('/', function(req, res) {
   res.render('home');
});

app.get('/about', function(req, res) {
   res.render('about');
});

// 404 catch-all handler (middleware)
app.use(function(req, res) {
   res.status(404);
   res.render('404');
});

// 500 error handler (middleware)
app.use(function(err, req, res, next) {
   console.error(err.stack);
   res.status(500);
   res.render('500');
});

app.listen(app.get('port'), function() {
   console.log('Express started on http://localhost:' + app.get('port') + '; press Ctrl-C to terminate.');
});
</code></pre>

<p>main.handlebars (main template):</p>

<pre><code>&lt;!DOCTYPE html&gt;

&lt;html&gt;

&lt;head&gt;
   &lt;title&gt;Meadowlark Travel&lt;/title&gt;
   {{#if showTexts}}
      &lt;link rel="stylesheet" href="/vendor/mocha.css"&gt;
   {{/if}}
&lt;script src="http://code.jquery.com/jquery-3.0.0.js" integrity="sha256-jrPLZ+8vDxt2FnE1zvZXCkCcebI/C8Dt5xyaQBjxQIo=" crossorigin="anonymous"&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
   &lt;header&gt;&lt;img src="/img/logo.png" alt="Meadowlark Travel logo"&gt;&lt;/header&gt;
   {{{body}}}

   {{#if showTests}}
      &lt;div id="mocha"&gt;&lt;/div&gt;
      &lt;script src="/vendor/mocha.js"&gt;&lt;/script&gt;
      &lt;script src="/vendor/chai.js"&gt;&lt;/script&gt;
      &lt;script&gt;
         mocha.ui('tdd');
         var assert = chai.assert;
      &lt;/script&gt;
      &lt;script src="/qa/tests-global.js"&gt;&lt;/script&gt;
      {{#if pageTestScript}}
         &lt;script src="{{pageTestScript}}"&gt;&lt;/script&gt;
      {{/if}}
      &lt;script&gt;mocha.run();&lt;/script&gt;
   {{/if}}
&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>public/qa/tests-global.js (location of Mocha tests):</p>

<pre><code>suite('Global Tests', function() {
   test('page has a valid title', function() {
      assert(document.title &amp;&amp; document.title.match(/\S/) &amp;&amp;  
         document.title.toUpperCase() !=== 'TODO');
   }); 
});
</code></pre>

<p>Folder Structure:</p>

<pre><code>meadowlark.js
node_modules &gt; *node.js/npm*
package.json
public &gt; qa     &gt; tests-global.js
       &gt; vendor &gt; chai.js,
                &gt; mocha.css,
                &gt; mocha.js
views &gt; home.handlebars
      &gt; layouts &gt; main.handlebars
</code></pre>

<p>What am I doing wrong, and how can I make it so the Mocha tests show up?  If you need any additional files, ask.</p>