Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7592289
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:52:13+00:00 2026-05-30T20:52:13+00:00

Intro I have jscoverage installed and have setup a make command to generate the

  • 0

Intro

I have jscoverage installed and have setup a make command to generate the coverage data to app-cov and runs the tests.

For this project I am using: node.js, mongoose, express, mocha and should.

Relevant files:

Makefile: http://pastie.org/3529374

index.js: http://pastie.org/3529377

test/models/location.test.js: http://pastie.org/3529401

app/run.js: http://pastie.org/3529523

Problem

The output coverage.html file overview is empty. 0% 0 SLOC 0 files in overview.

My assumption is that mocha is not recognizing or loading the coverage from app-cov. I’ve only written a single unit test for the location model. Is it the way I’m requiring the files in the test?

I’m use to phpunit and it’s configuration so I’m having a little trouble putting the test suite together.

Ups to anyone who can recommend a solution or how tidy up my ugle code 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T20:52:14+00:00Added an answer on May 30, 2026 at 8:52 pm

    Your makefile has many issues.

    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.”

    2- Both your test: and test-cov: 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 express library Makefile for a good example. If you follow this example, your test: entry should NOT set EXPRESS_COV.

    3- Your gen-cov entry is wrong, it should in fact be called app-cov: 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.

    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.

    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.

    6- In test-cov, your “l” in coverage.html seems to be on a separate line, though it could be the pastebin.

    To recap (I’ve kept app and app-cov, though I suggest lib and lib-cov):

    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 > docs/report/coverage.html
    
    .PHONY: test 
    

    Edit: And I just noticed that in your test code, you require a model explicitly in the /app/ folder. You must use the EXPRESS_COV variable as you did in the index file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is part of a matlab intro course for biologists. I have my data
Intro: EDIT: See solution at the bottom of this question (c++) I have a
I have following structure with example data: id season_id title 1 1 Intro 2
I have a Document class, Intro class and Nav class. The Intro class runs
I'm in an intro level programming class and I have to make a grade
Intro We have a project to design and implement this semester. For our project,
I have this on a page: <p class="test" style="width: 300px" title="intro">Lorem ipsum dolor sit
I have a MPMoviePlayer setup to play an intro movie to my application. That
I have to ask this question because I've never programmed except in an intro
I have Flex 4 app which is deployed in internet. Just as an intro,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.