問題が発生しており、どこからトラブルシューティングを開始すればよいかさえよくわかりません。
少し変更した mocha-casperjsを使用しています。CasperJS は PhantomJS のラッパーです。テストの完了時に Growl 通知を統合しようとしています。
次のように、mocha.run を呼び出す前に通知を正常に実行できます。
execFile("terminal-notifier", ["-message", "Tests Begin"], null, function (err, stdout, stderr) {
console.log("execFileSTDOUT:", JSON.stringify(stdout))
console.log("execFileSTDERR:", JSON.stringify(stderr))
})
// for convience, expose the current runner on the mocha global
mocha.runner = mocha.run(function() {
...
ただし、これは失敗します。
// for convience, expose the current runner on the mocha global
mocha.runner = mocha.run(function() {
execFile("terminal-notifier", ["-message", "Tests Begin"], null, function (err, stdout, stderr) {
console.log("execFileSTDOUT:", JSON.stringify(stdout))
console.log("execFileSTDERR:", JSON.stringify(stderr))
})
...
Mocha や PhantomJS の根性についてはあまり知りません。Mocha が stdout などを食べて、execFile 呼び出しが失敗する可能性はありますか? 私が得ていないものは他にありますか?
ありがとう、ケビン
- - アップデート - -
プロットが厚くなります。casper オブジェクトを含めるだけで、execFile が強制終了されます。
「casperjs test.js」で以下のコードを実行すると、execFile が正常に出力されます。casper オブジェクトのコメントを外すと、何も出力されません。
'use strict';
var process = require("child_process");
var spawn = process.spawn;
var execFile = process.execFile;
execFile("ls", ["-lF", "/usr"], null, function (err, stdout, stderr) {
console.log("execFileSTDOUT:", JSON.stringify(stdout));
console.log("execFileSTDERR:", JSON.stringify(stderr));
});
//var casper = require('casper').create();
//casper.exit();