2015-11-16 12 views
5

私はジャスミンで動作するようにイスタンブールを取得することができません:Node.jsのイスタンブールとジャスミンのセットアップ

{ 
    "name": "ttm-jira", 
    "version": "1.0.0", 
    "description": "nodeJS module to provide access to the JIRA REST API", 
    "author": { 
    "name": "...", 
    "url" : "...." 
    }, 
    "main": "jira.js", 
    "private": true, 
    "repository": { 
    "type": "git", 
    "url" : "https://........git" 
    }, 
    "bugs": { 
    "url" : "https://jira2........." 
    }, 
    "scripts": { 
    "test"   : "npm run code-coverage && npm run unit-test", 
    "unit-test" : "jasmine-node . --autotest --captureExceptions --watch", 
    "code-coverage": "istanbul cover --include-all-sources" 
    }, 
    "devDependencies": { 
    "istanbul" : "^0.4.0", 
    "jasmine-node": "^1.14.5" 
    }, 
    "dependencies": { 

    }, 
"engines": { 
    "node": ">=0.10.24" 
    } 
} 

ここでは私のディレクトリ構造は、私のpackage.jsonはこのようになります

ttm-jira 
    - package.json 
    - spec 
      - jira-spec.js 

です

私のttm-jiraフォルダからnpm-testを実行すると、次のように表示されます。

> [email protected] test C:\SRM\node_modules\ttm-jira 
> npm run code-coverage && npm run unit-test 


> [email protected] code-coverage C:\SRM\node_modules\ttm-jira 
> istanbul cover --include-all-sources 

Need a filename argument for the cover command! 
Try "istanbul help" for usage 

npm ERR! Windows_NT 6.1.7601 
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run 
" "code-coverage" 
npm ERR! node v4.2.1 
npm ERR! npm v2.14.7 
npm ERR! code ELIFECYCLE 
npm ERR! [email protected] code-coverage: `istanbul cover --include-all-sources` 
npm ERR! Exit status 1 
npm ERR! 
npm ERR! Failed at the [email protected] code-coverage script 'istanbul cover --include-all-sources'. 
npm ERR! This is most likely a problem with the ttm-jira package, 
npm ERR! not with npm itself. 
npm ERR! Tell the author that this fails on your system: 
npm ERR!  istanbul cover --include-all-sources 
npm ERR! You can get their info via: 
npm ERR!  npm owner ls ttm-jira 
npm ERR! There is likely additional logging output above. 

npm ERR! Please include the following file with any support request: 
npm ERR!  C:\SRM\node_modules\ttm-jira\npm-debug.log 
npm ERR! Test failed. See above for more details. 
PS C:\SRM\node_modules\ttm-jira> 

どうすればこの仕事をすることができますか?

OR

私はTTM-JIRAディレクトリから次のコマンドを実行した場合:

PS C:\SRM\node_modules\ttm-jira> istanbul cover -x ./spec/jira-spec.js jasmine-node test 
No coverage information was collected, exit without writing coverage information 
C:\Users\SW029693\AppData\Roaming\npm\jasmine-node.CMD:1 
(function (exports, require, module, __filename, __dirname) { @IF EXIST "%~dp0\node.exe" (
                  ^

SyntaxError: Unexpected token ILLEGAL 
    at exports.runInThisContext (vm.js:53:16) 
    at Module._compile (module.js:414:25) 
    at Object.Module._extensions..js (module.js:442:10) 
    at Object.Module._extensions.(anonymous function) [as .js] (C:\Users\SW029693\AppData\Roaming\npm\node_modules\istan 
bul\lib\hook.js:109:37) 
    at Module.load (module.js:356:32) 
    at Function.Module._load (module.js:311:12) 
    at Function.Module.runMain (module.js:467:10) 
    at runFn (C:\Users\SW029693\AppData\Roaming\npm\node_modules\istanbul\lib\command\common\run-with-cover.js:122:16) 
    at C:\Users\SW029693\AppData\Roaming\npm\node_modules\istanbul\lib\command\common\run-with-cover.js:251:17 
    at C:\Users\SW029693\AppData\Roaming\npm\node_modules\istanbul\lib\util\file-matcher.js:68:16 
    PS C:\SRM\node_modules\ttm-jira> istanbul cover ./spec/jira-spec.js jasmine-node test 
    ============================================================================= 
    Writing coverage object [C:\SRM\node_modules\ttm-jira\coverage\coverage.json] 
    Writing coverage reports at [C:\SRM\node_modules\ttm-jira\coverage] 
    ============================================================================= 

    =============================== Coverage summary =============================== 
    Statements : 33.33% (1/3) 
    Branches  : 100% (0/0) 
    Functions : 0% (0/2) 
    Lines  : 33.33% (1/3) 
    ================================================================================ 
    C:\SRM\node_modules\ttm-jira\spec\jira-spec.js:9 
    __cov_Xe4IzZ5pgGmSS4dHihZPbQ.s['1']++;describe('A suite',function(){__cov_Xe4IzZ5pgGmSS4dHihZPbQ.f['1']++;__cov_Xe4IzZ5p 
    gGmSS4dHihZPbQ.s['2']++;it('contains spec with an expectation',function(){__cov_Xe4IzZ5pgGmSS4dHihZPbQ.f['2']++;__cov_Xe 
    4IzZ5pgGmSS4dHihZPbQ.s['3']++;expect(true).toBe(true);});}); 
             ^

    ReferenceError: describe is not defined 
     at Object.<anonymous> (C:\SRM\node_modules\ttm-jira\spec\jira-spec.js:9:39) 
     at Module._compile (module.js:435:26) 
     at Object.Module._extensions.(anonymous function) [as .js] (C:\Users\SW029693\AppData\Roaming\npm\node_modules\istan 
    bul\lib\hook.js:107:24) 
     at Module.load (module.js:356:32) 
     at Function.Module._load (module.js:311:12) 
     at Function.Module.runMain (module.js:467:10) 
     at runFn (C:\Users\SW029693\AppData\Roaming\npm\node_modules\istanbul\lib\command\common\run-with-cover.js:122:16) 
     at C:\Users\SW029693\AppData\Roaming\npm\node_modules\istanbul\lib\command\common\run-with-cover.js:251:17 
     at C:\Users\SW029693\AppData\Roaming\npm\node_modules\istanbul\lib\util\file-matcher.js:68:16 
     at C:\Users\SW029693\AppData\Roaming\npm\node_modules\istanbul\node_modules\async\lib\async.js:52:16 
    PS C:\SRM\node_modules\ttm-jira> istanbul cover --include-all-sources jasmine-node test 
    No coverage information was collected, exit without writing coverage information 
    C:\Users\SW029693\AppData\Roaming\npm\jasmine-node.CMD:1 
    (function (exports, require, module, __filename, __dirname) { @IF EXIST "%~dp0\node.exe" (
                   ^

    SyntaxError: Unexpected token ILLEGAL 
     at exports.runInThisContext (vm.js:53:16) 
     at Module._compile (module.js:414:25) 
     at Object.Module._extensions..js (module.js:442:10) 
     at Object.Module._extensions.(anonymous function) [as .js] (C:\Users\SW029693\AppData\Roaming\npm\node_modules\istan 
    bul\lib\hook.js:109:37) 
     at Module.load (module.js:356:32) 
     at Function.Module._load (module.js:311:12) 
     at Function.Module.runMain (module.js:467:10) 
     at runFn (C:\Users\SW029693\AppData\Roaming\npm\node_modules\istanbul\lib\command\common\run-with-cover.js:122:16) 
     at C:\Users\SW029693\AppData\Roaming\npm\node_modules\istanbul\lib\command\common\run-with-cover.js:251:17 
     at C:\Users\SW029693\AppData\Roaming\npm\node_modules\istanbul\lib\util\file-matcher.js:68:16 
PS C:\SRM\node_modules\ttm-jira> 

または私が行う

istanbul cover ./spec/jira-spec.js 
:私は、次のメッセージが表示されます

istanbul cover ./spec/jira-spec.js jasmine-node test 

igら以下:

 ReferenceError: describe is not defined 
     at Object.<anonymous> (C:\SRM\node_modules\ttm-jira\spec\jira-spec.js:9:39) 
     at Module._compile (module.js:435:26) 
     at Object.Module._extensions.(anonymous function) [as .js] (C:\Users\SW029693\AppData\Roaming\npm\node_modules\istan 
    bul\lib\hook.js:107:24) 
     at Module.load (module.js:356:32) 
     at Function.Module._load (module.js:311:12) 
     at Function.Module.runMain (module.js:467:10) 
     at runFn (C:\Users\SW029693\AppData\Roaming\npm\node_modules\istanbul\lib\command\common\run-with-cover.js:122:16) 
     at C:\Users\SW029693\AppData\Roaming\npm\node_modules\istanbul\lib\command\common\run-with-cover.js:251:17 
     at C:\Users\SW029693\AppData\Roaming\npm\node_modules\istanbul\lib\util\file-matcher.js:68:16 
     at C:\Users\SW029693\AppData\Roaming\npm\node_modules\istanbul\node_modules\async\lib\async.js:52:16 
    PS C:\SRM\node_modules\ttm-jira> istanbul cover --include-all-sources jasmine-node test 
    No coverage information was collected, exit without writing coverage information 
    C:\Users\SW029693\AppData\Roaming\npm\jasmine-node.CMD:1 
    (function (exports, require, module, __filename, __dirname) { @IF EXIST "%~dp0\node.exe" (
                   ^

答えて

1

フォーマットがある:あなたのケースでは

istanbul cover [options] test_script [-- test-script-options] 

istanbul cover --include-all-sources jasmine-node 
+0

私は新しい試みで上記の私の答えを更新しましたが、それでもエラーが表示(メインの質問に掲示)、あなたは私がコマンドで間違っていることを発見することができますか? – Rookie

+0

私が書いたことを試してみてください。 –

関連する問題