0

由于某种原因,我无法将程序的 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

在上述每种情况下,仅保存第一行。

4

2 回答 2

0

我找到的唯一解决方案是:

cmd /c "node "$mocha" --reporter xunit "$testScript" > result.xml"
于 2013-10-17T07:39:42.583 回答
0

一种 WAG,因为我没有那个可执行文件,但是:

(node $mocha --reporter xunit $testScript) |  add-content result.xml
于 2013-10-16T12:27:34.180 回答