2017-05-30 8 views
0

私はインターン4.0を使用しています(はい!私はアルファバージョンですが、私はコードとユニットテストをes6で書き直したいです)。インターン4:テストスイートを実行できません

npmパッケージ「intern 4.0.0-alpha.4」をインストールしました。コード、単体テスト、スイートをes6に書き直しました。

しかし、私はテストを実行することができません。私が欲しい はNPMスクリプトからのテストを実行します。私は得るために、私package.jsonファイルを編集した:

"scripts": { 
    "test": "node_modules/.bin/intern" 
} 

もしてみました、私は「M:

"scripts": { 
    "test": "node_modules/.bin/intern config=intern.json" 
} 

またはインターCLIを使用して:

"scripts": { 
    "test": "intern run --config intern.json" 
} 

次に、コマンドを実行します。npm run test

ここにログファイル:

0 info it worked if it ends with ok 
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe', 
1 verbose cli 'C:\\Users\\admin\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js', 
1 verbose cli 'run', 
1 verbose cli 'test' ] 
2 info using [email protected] 
3 info using [email protected] 
4 verbose run-script [ 'pretest', 'test', 'posttest' ] 
5 info lifecycle [email protected]~pretest: [email protected] 
6 silly lifecycle [email protected]~pretest: no script for pretest, continuing 
7 info lifecycle [email protected]~test: [email protected] 
8 verbose lifecycle [email protected]~test: unsafe-perm in lifecycle true 
9 verbose lifecycle [email protected]~test: PATH: ... 
10 verbose lifecycle [email protected]~test: CWD: D:\Temp\myproject 
11 silly lifecycle [email protected]~test: Args: [ '/d /s /c', 'intern config=intern.json' ] 
12 silly lifecycle [email protected]~test: Returned: code: 1 signal: null 
13 info lifecycle [email protected]~test: Failed to exec test script 
14 verbose stack Error: [email protected] test: `intern config=intern.json` 
14 verbose stack Exit status 1 
14 verbose stack  at EventEmitter.<anonymous> (C:\Users\admin\AppData\Roaming\npm\node_modules\npm\lib\utils\lifecycle.js:279:16) 
14 verbose stack  at emitTwo (events.js:106:13) 
14 verbose stack  at EventEmitter.emit (events.js:191:7) 
14 verbose stack  at ChildProcess.<anonymous> (C:\Users\admin\AppData\Roaming\npm\node_modules\npm\lib\utils\spawn.js:40:14) 
14 verbose stack  at emitTwo (events.js:106:13) 
14 verbose stack  at ChildProcess.emit (events.js:191:7) 
14 verbose stack  at maybeClose (internal/child_process.js:886:16) 
14 verbose stack  at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5) 
15 verbose pkgid [email protected] 
16 verbose cwd D:\Temp\myproject 
17 verbose Windows_NT 10.0.14393 
18 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\admin\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "test" 
19 verbose node v6.10.3 
20 verbose npm v4.4.4 
21 error code ELIFECYCLE 
22 error errno 1 
23 error [email protected] test: `intern config=intern.json` 
23 error Exit status 1 
24 error Failed at the [email protected] test script 'intern config=intern.json'. 
24 error Make sure you have the latest version of node.js and npm installed. 
24 error If you do, this is most likely a problem with the myproject package, 
24 error not with npm itself. 
24 error Tell the author that this fails on your system: 
24 error  intern config=intern.json 
24 error You can get information on how to open an issue for this project with: 
24 error  npm bugs myproject 
24 error Or if that isn't available, you can get their info via: 
24 error  npm owner ls myproject 
24 error There is likely additional logging output above. 
25 verbose exit [ 1, true ] 

アイデアはありますか?

答えて

1

あなたはinternnode_modules/.binのbinスクリプトなので、あなたがpackage.jsonnode_modules/.binを使用する必要はありません

"scripts": { 
    "test": "intern" 
} 

を使用することができます。

はちょうどあなたがあなたが intern.jsonで設定したスイートを実行する必要があります

node node_modules\.bin\intern 

インターンを実行してみることができ、確認します。

+0

はい、私はこれを '4.0.0-alpha.5'と併用します。しかし、 'npm run test'は' Feature 'オブジェクト割り当てが存在していて失敗し、上書きできません.'私はテストスイートなしで試して、私は同じエラーがあります。なぜ私は見つからない! – Troopers

+0

これは特にあなたのスイートではなくテストランナーを読み込む問題に似ています。あなたの 'intern.json'の外観はどうですか? 'intern.json'を削除して実行すると、インターンは何をしますか?のみ – jason0x43

+0

: '{ \t "プラグイン": "node_modules /バベル登録/ LIB /のNode.js"、 \t "スイート": "テスト/ユニット/ test.js" }'私は同じエラーを持っているものは何でもintern.jsonファイルの内容 – Troopers

関連する問題