9

Jasmineの上に構築されたJavascript JestテストフレームワークにJenkinsを統合する方法はありますか?

Jest をjasmine-reportersと統合しようとしましたが、JUnit XML 出力を取得できませんでした。Jasmine 1.3 のレポーターをインストールしてnpm install jasmine-reporters@~1.0.0から、次のようにしますsetupTestFrameworkScriptFile

require('jasmine-reporters');

jasmine.VERBOSE = true;

jasmine.getEnv().addReporter(new jasmine.JUnitXmlReporter({
  savePath: "output/"
}));

実行すると、またはjestが得られます。NodeJS attempt: Arguments to path.join must be stringsNodeJS attempt: Object [object Object] has no method 'join'

4

3 に答える 3

7

私はこのレポでそれの作業バージョンを取得することができました。問題は、私が嘲笑しておらずpathfsテストファイルに含まれていたことです。

于 2014-08-27T09:04:55.347 に答える
4

jasmine-reporters 2.x の構文を 1.x ブランチで使用しています。具体的には、オプションのオブジェクトを渡していますが、位置引数を送信する必要があります。

これをしないでください:

jasmine.getEnv().addReporter(new jasmine.JUnitXmlReporter({
  savePath: "output/"
}));

代わりに、次のようにする必要があります。

jasmine.getEnv().addReporter(new jasmine.JUnitXmlReporter("output/"));

利用可能なオプションのリストについては、ソースをチェックアウトできます。現在のオプションは次のとおりです。

/**
 * Generates JUnit XML for the given spec run.
 * Allows the test results to be used in java based CI
 * systems like CruiseControl and Hudson.
 *
 * @param {string} [savePath] where to save the files
 * @param {boolean} [consolidate] whether to save nested describes within the
 *                  same file as their parent; default: true
 * @param {boolean} [useDotNotation] whether to separate suite names with
 *                  dots rather than spaces (ie "Class.init" not
 *                  "Class init"); default: true
 * @param {string} [filePrefix] is the string value that is prepended to the
 *                 xml output file; default: 'TEST-'
 * @param {boolean} [consolidateAll] whether to save test results from different
 *                  specs all in a single file; filePrefix is then the whole file
 *                  name without extension; default: false
 */
var JUnitXmlReporter = function(savePath, consolidate, useDotNotation, filePrefix, consolidateAll) {
    /* ... */
}
于 2014-08-06T19:45:40.420 に答える