Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Your makefile has many issues.</p> <p>1- Why do you need the TESTS variable? Your tests are in the test/ subdirectory, so unless you have other .js files there (why would you?), then this is the default for mocha: "By default mocha(1) will use the pattern ./test/*.js, so it’s usually a good place to put your tests."</p> <p>2- Both your <code>test:</code> and <code>test-cov:</code> entries set the EXPRESS_COV environment variable to 1, meaning that you have no way to run tests without the coverage option (no way with the makefile, that is). This may be fine if you always want to do tests with coverage, but then why have 2 entries? Look at the <a href="https://github.com/visionmedia/express/blob/master/Makefile" rel="nofollow">express library Makefile</a> for a good example. If you follow this example, your <code>test:</code> entry should NOT set EXPRESS_COV.</p> <p>3- Your gen-cov entry is wrong, it should in fact be called <code>app-cov:</code> based on the name of the subdirectory where you store your instrumented files. By the way, why not choose the standard "lib-cov" (and "lib" for your non-instrumented js files)? Certainly not required, but it is a convention followed by many in the community.</p> <p>4- Why do you remove your instrumented files before running jscoverage? Not sure if it can cause problems with make, don't think so, but it's useless and should be removed.</p> <p>5- test-cov should now depend on app-cov (that's probably the heart of the problem, make never detected that the dependency was outdated, because the dependency doesn't exist!). test-cov does and should indeed set the EXPRESS_COV=1 environment variable.</p> <p>6- In test-cov, your "l" in coverage.html seems to be on a separate line, though it could be the pastebin.</p> <p>To recap (I've kept app and app-cov, though I suggest lib and lib-cov):</p> <pre><code>REPORTER = dot test: @NODE_ENV=test ./node_modules/.bin/mocha -b \ --reporter $(REPORTER) app-cov: jscoverage app app-cov test-cov: app-cov @EXPRESS_COV=1 $(MAKE) test REPORTER=html-cov &gt; docs/report/coverage.html .PHONY: test </code></pre> <p>Edit: And I just noticed that in your test code, you <code>require</code> a model explicitly in the /app/ folder. You must use the EXPRESS_COV variable as you did in the index file.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload