由于某种原因,我无法将程序的 xml 输出重定向到文件或任何地方。命令是:
node $mocha --reporter xunit $testScript
<testsuite name="Mocha Tests" tests="40" failures="0" errors="0" skipped="0" timestamp="Wed, 16 Oct 2013 11:03:28 GMT" t
ime="0.664">
<testcase classname="Testing preview" name="preview index is set to correct value" time="0.007"/>
...
但是,当我想将其保存到文件时,没有任何效果。只保存第一行。我尝试了以下方法:
node $mocha --reporter xunit $testScript >result.xml
node $mocha --reporter xunit $testScript | tee result.xml
node $mocha --reporter xunit $testScript | out-file result.xml
node $mocha --reporter xunit $testScript | out-string result.xml
node $mocha --reporter xunit $testScript | set-content result.xml
node $mocha --reporter xunit $testScript | add-content result.xml
iex(node ...) | out-string results.xml
$res = node $mocha --reporter xunit $testScript
在上述每种情况下,仅保存第一行。