1

I have 24 tests.

jasmine-node spec
........................
Finished in 2.061 seconds
24 tests, 54 assertions, 0 failures, 0 skipped

When I run istanbul, it appears to only run 14 tests.

istanbul cover jasmine-node spec
..............
=====================================================
Writing coverage object [/Users/jared/git/redacted/redacted/coverage/coverage.json]
etc ..

Why is istanbul not running all of my tests?

Configuration

spec/support/jasmine.json

{
  "spec_dir": "spec",
  "spec_files": ["**/*_spec.js"],
  "helpers": ["helpers/**/*.js"]
}

.istanbul.yml

verbose: false
instrumentation:
  root: .
  extensions:
    - .js
  default-excludes: true
  excludes: [
    "bootstrap/js/bootstrap*.js",
    "bootstrap/js/jquery*.js",
    "bootstrap/js/lz-string-1.3.3-min.js",
    "bootstrap/js/moment-with-langs.min.js",
    "bootstrap/js/Sha256.js",
    "bootstrap/js/spin*.js",
    "bootstrap/js/underscore*.js",
    "env-0.10.20-prebuilt/**",
    "node_modules/**",
    "spec/**"
  ]
  embed-source: false
  variable: __coverage__
  compact: true
  preserve-comments: false
  complete-copy: false
  save-baseline: false
  baseline-file: ./coverage/coverage-baseline.json
  include-all-sources: true
  include-pid: false
reporting:
  print: summary
  reports:
    - lcov
  dir: ./coverage
  watermarks:
    statements: [50, 80]
    lines: [50, 80]
    functions: [50, 80]
    branches: [50, 80]
  report-config:
    clover: {file: clover.xml}
    cobertura: {file: cobertura-coverage.xml}
    json: {file: coverage-final.json}
    json-summary: {file: coverage-summary.json}
    lcovonly: {file: lcov.info}
    teamcity: {file: null, blockName: Code Coverage Summary}
    text: {file: null, maxCols: 0}
    text-lcov: {file: lcov.info}
    text-summary: {file: null}
hooks:
  hook-run-in-context: false
  post-require-hook: null
  handle-sigint: false
check:
  global:
    statements: 0
    lines: 0
    branches: 0
    functions: 0
    excludes: []
  each:
    statements: 0
    lines: 0
    branches: 0
    functions: 0
    excludes: []

Spec directory:

tree spec
spec
├── api
│   └── utils_spec.js
├── emailer
│   ├── emailer_spec.js
│   ├── mail_redacted1_spec.js
│   └── mail_redacted2_spec.js
├── fixtures
│   └── emailer
│       ├── redacted1
│       │   ├── in.html
│       │   └── out.html
│       └── redacted2
│           ├── in.html
│           └── out.html
├── redacted3
│   └── index_spec.js
├── lzstring
│   └── lzstring_spec.js
├── repository
│   └── users_spec.js
├── support
│   ├── factories
│   │   └── users.js
│   └── jasmine.json
└── utils
    └── index_spec.js

12 directories, 14 files
Jared Beck
  • 16,796
  • 9
  • 72
  • 97
  • 1
    I personally have no big experience working with instanbul js but If you can share some more information on your file structure or if this is an open source project you can supply a link. I will gladly try to solve it :) – kazandzhiro Nov 16 '15 at 19:46
  • What part of the file structure would be helpful? I'll see if it's something I can share. – Jared Beck Nov 16 '15 at 20:00
  • I think the spec folder structure would be sufficient – kazandzhiro Nov 16 '15 at 20:48
  • I have added the folder structure. – Jared Beck Nov 16 '15 at 21:12
  • I have created a sample structure like yours and my tests are all run. May be it is something else in your workflow. You could change verbose from **false** to **true** to see if there will be any useful messages. – kazandzhiro Nov 16 '15 at 21:59

1 Answers1

0

By changing

istanbul cover jasmine-node spec

to

istanbul cover node_modules/.bin/jasmine

I am no longer able to reproduce the problem.

I didn't realize when I wrote the question, but I am able to reproduce this issue with

jasmine-node spec

alone, which means this issue has nothing to do with istanbul.

Jared Beck
  • 16,796
  • 9
  • 72
  • 97
  • Why .bin? Has jasmine changed in the past few months? I am asking as I am running into a similar issue, but now the docs say istanbul cover node_modules\jasmine\bin\jasmine.js – Winnemucca Mar 21 '16 at 20:18