为什么成功的TAP测试后Powershell出错?

问题描述:

我在Windows上运行的节点测试与Appveyor,并创下了问题只有一个环境:PowerShell和节点0.10。为什么成功的TAP测试后Powershell出错?

的其他节点的版本,我得到的输出是这样的:

npm test # PowerShell 
#... 

TAP version 13 
# find rc file in third searched dir, with a package.json lacking prop 
ok 1 should be equal 
ok 2 first dir: checked /a/b/c/d/e/f/package.json 
ok 3 first dir: checked /a/b/c/d/e/f/.foorc 
# ... 

1..72 
# tests 72 
# pass 72 

# ok 

npm test 
# ... 

但在节点0.10.40,与NPM 1.4.28,我得到这个:

npm test # PowerShell 
#... 

TAP version 13 
# find rc file in third searched dir, with a package.json lacking prop 
ok 1 should be equal 
ok 2 first dir: checked /a/b/c/d/e/f/package.json 
ok 3 first dir: checked /a/b/c/d/e/f/.foorc 
# ... 

1..72 
# tests 72 
# pass 72 

# ok 

npm : 
At line:1 char:1 
+ npm test # PowerShell 
+ ~~~~~~~~ 
    + CategoryInfo   : NotSpecified: (:String) [], RemoteException 
    + FullyQualifiedErrorId : NativeCommandError 

C:\projects\cosmiconfig\test\a\b\foo.config.js:1 
quire, module, __filename, __dirname) { module.exports = { found: true: false, 
                    ^

Command executed with exception: C:\projects\cosmiconfig\test\a\b\foo.config.js:1 
quire, module, __filename, __dirname) { module.exports = { found: true: false, 
                    ^

这行代码它的抱怨是一种有意的错误 - 测试的一部分 - 这是(我相信)捕捉和处理,以及测试,以确保发生错误。

在Windows为什么节点仅0.10(这不会在Unix上特拉维斯通过发生)有这个问题?我需要做些什么来解决它?

(如果你需要其他的细节,以解决请让我知道:我不知道有足够的了解什么错知道大家交流一下。)

+1

错误只是说,该应用程序写的东西在其错误流。您可以执行'cmd/c npm test'2>&1'',以便错误流将在标准输出中重定向。 – PetSerAl

看起来像旧版本NPM的写一些东西,虽然标准错误他们实际上并没有用错误代码退出进程。正如@PetSerAl所说,Powershell会在这种情况发生时出错,但其他终端不会。该解决方案似乎只是不在Powershell中运行这些测试。

cf. http://help.appveyor.com/discussions/problems/2347-npm-275prefer-global-warning-causes-failure-command-executed-with-exceptionhttps://github.com/npm/npm/issues/8517