javascript - Istanbul 尔没有运行所有 Jasmine 规范?

标签 javascript jasmine jasmine-node istanbul

我有 24 项测试。

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

当我运行istanbul时,它似乎只运行了 14 个测试。

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

为什么 Istanbul 尔没有运行我的所有测试?

配置

规范/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: []

规范目录:

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

最佳答案

通过改变

istanbul cover jasmine-node spec

istanbul cover node_modules/.bin/jasmine

我无法再重现该问题。

我在写问题时没有意识到,但我能够重现这个问题

jasmine-node spec

单独,这意味着这个问题与 Istanbul 尔无关。

关于javascript - Istanbul 尔没有运行所有 Jasmine 规范?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33742516/

相关文章:

javascript - 如何让图像在一行中一直贯穿整个屏幕

javascript - Json.Net 中 JSON 中引用属性顺序的问题

javascript - 尝试创建自定义 Bootstrap 导航栏

visual-studio - Chutzpah Visual Studio 测试运行器找不到 JS 引用

javascript - 如何使用更多 "expect"函数扩展 frisby.js?

typescript - 通过 bazel 执行 Jasmine 测试时未找到规范

javascript - 你能异步通知网络浏览器吗?

angular - 监视返回可观察对象的函数

javascript - Jasmine:使用callFake后,如何恢复到原来的功能?

javascript - 为什么这个 jasmine-node 测试没有失败?