Jasmine调用绝对没有返回

时间:2016-09-06 21:12:10

标签: node.js npm jasmine

根据jasmine documentation,我应该可以运行运行jasmine的测试套件。

即使在将JASMINE_CONFIG_PATH导出到jasmine.json文件或将其作为参数传递之后,在测试目录中运行jasmine的

On this repository也绝对没有任何作用。请注意,即使更改测试以使其失败,我也没有结果,没有错误,没有。该命令只返回提示符。

这是文件的内容

$ more jasmine.json 
{
  "spec_dir": "test",
  "stopSpecOnExpectationFailure": false,
  "random": false,
  "spec_files": ["*spec.js"]
}


(venv) sborini@MacBook-Pro:test (protocol-host-rewrite) [1 stash] $ ls `which jasmine`
/usr/local/bin/jasmine

的package.json

{
  "version": "1.4.0-dev",
  "name": "configurable-http-proxy",
  "description": "A configurable-on-the-fly HTTP Proxy",
  "author": "Jupyter Developers",
  "license": "BSD-3-Clause",
  "repository": {
    "type": "git",
    "url": "https://github.com/jupyterhub/configurable-http-proxy.git"
  },
  "dependencies": {
    "commander": "~2.9",
    "http-proxy": "~1.13.2",
    "lynx": "^0.2.0",
    "strftime": "~0.9",
    "winston": "~2.2"
  },
  "devDependencies": {
    "jasmine": "^2.4.1",
    "jshint": "^2.9.2",
    "nyc": "^6.4.0",
    "request": "~2",
    "ws": "^1.1"
  },
  "main": "index.js",
  "files": [
    "index.js",
    "lib/configproxy.js",
    "lib/trie.js",
    "lib/error/*.html",
    "bin/configurable-http-proxy"
  ],
  "bin": {
    "configurable-http-proxy": "bin/configurable-http-proxy"
  },
  "scripts": {
    "jshint": "jshint bin/ lib/ test/",
    "test": "nyc jasmine JASMINE_CONFIG_PATH=test/jasmine.json",
    "coverage-html": "nyc report --reporter=html",
    "codecov": "nyc report --reporter=lcov && codecov"
  }
}

请注意,使用npm run test调用它确实会产生coverage的输出,但是如果我测试错误,它只会生成以下输出

(venv) sborini@MacBook-Pro:configurable-http-proxy (protocol-host-rewrite) [1 stash] $ npm run test

> configurable-http-proxy@1.4.0-dev test /Users/sborini/Work/github/stefanoborini/configurable-http-proxy
> nyc jasmine JASMINE_CONFIG_PATH=test/jasmine.json

-----------------|----------|----------|----------|----------|----------------|
File             |  % Stmts | % Branch |  % Funcs |  % Lines |Uncovered Lines |
-----------------|----------|----------|----------|----------|----------------|
 lib/            |     89.9 |       75 |    83.58 |    90.36 |                |
  configproxy.js |    87.01 |    64.81 |    84.78 |     87.6 |... 436,437,444 |
  testutil.js    |    93.83 |    93.75 |    73.33 |    93.83 |... 114,116,117 |
  trie.js        |    96.72 |       95 |      100 |    96.72 |          15,19 |
-----------------|----------|----------|----------|----------|----------------|
All files        |     89.9 |       75 |    83.58 |    90.36 |                |
-----------------|----------|----------|----------|----------|----------------|


npm ERR! Darwin 14.5.0
npm ERR! argv "/usr/local/Cellar/node/5.10.1/bin/node" "/usr/local/bin/npm" "run" "test"
npm ERR! node v5.10.1
npm ERR! npm  v3.8.3
npm ERR! code ELIFECYCLE
npm ERR! configurable-http-proxy@1.4.0-dev test: `nyc jasmine JASMINE_CONFIG_PATH=test/jasmine.json`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the configurable-http-proxy@1.4.0-dev test script 'nyc jasmine JASMINE_CONFIG_PATH=test/jasmine.json'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the configurable-http-proxy package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     nyc jasmine JASMINE_CONFIG_PATH=test/jasmine.json
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs configurable-http-proxy
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls configurable-http-proxy
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/sborini/Work/github/stefanoborini/configurable-http-proxy/npm-debug.log

这并没有告诉我任何有关实际失败测试的信息。

1 个答案:

答案 0 :(得分:2)

对于所有的googlers来说,这是茉莉花中的一个错误。

https://github.com/jasmine/jasmine-npm/issues/90

安装并使用旧版本:

npm install jasmine@~2.4

这很有效。