Angularjs 使用npm任务进行VSTS角度测试
我在VSTS中有一个可以工作的构建管道,它包含以下步骤Angularjs 使用npm任务进行VSTS角度测试,angularjs,unit-testing,continuous-integration,azure-pipelines,Angularjs,Unit Testing,Continuous Integration,Azure Pipelines,我在VSTS中有一个可以工作的构建管道,它包含以下步骤 .NET核心还原 .NET核心构建 .NET核心测试 公布测试结果 .Net核心发布 现在我想添加几个额外的步骤来运行npm(角度)测试。我有一个package.json,它定义了所有典型的命令,包括test和testsinglerun。它引用了茉莉花心、因果报应等。如果有人想看,我可以发布完整的文件。在我的机器上的命令行中,我可以运行npm run test single run命令,它按照预期工作并执行测试 在步骤4之后,我在上面的构建
C:\Windows\system32\cmd.exe /D /S /C ""C:\Program Files\nodejs\npm.cmd" run test-single-run"
> Cranalytics@1.0.0 test-single-run d:\a\1\s\src\Cranalytics
> karma start wwwroot/karma.conf.js --single-run
[33m07 07 2017 15:13:06.270:WARN [watcher]: [39mPattern "d:/a/1/s/src/Cranalytics/wwwroot/lib/ngInfiniteScroll/build/ng-infinite-scroll.min.js" does not match any file.
[32m07 07 2017 15:13:06.759:INFO [karma]: [39mKarma v1.7.0 server started at http://0.0.0.0:9876/
[32m07 07 2017 15:13:06.760:INFO [launcher]: [39mLaunching browser Chrome with unlimited concurrency
[32m07 07 2017 15:13:06.769:INFO [launcher]: [39mStarting browser Chrome
[33m07 07 2017 15:14:06.773:WARN [launcher]: [39mChrome have not captured in 60000 ms, killing.
[33m07 07 2017 15:14:08.777:WARN [launcher]: [39mChrome was not killed in 2000 ms, sending SIGKILL.
[33m07 07 2017 15:14:10.778:WARN [launcher]: [39mChrome was not killed by SIGKILL in 2000 ms, continuing.
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "test-single-run"
npm ERR! node v6.10.0
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! Cranalytics@1.0.0 test-single-run: `karma start wwwroot/karma.conf.js --single-run`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the Cranalytics@1.0.0 test-single-run script 'karma start wwwroot/karma.conf.js --single-run'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the Cranalytics package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! karma start wwwroot/karma.conf.js --single-run
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs Cranalytics
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls Cranalytics
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! d:\a\1\s\src\Cranalytics\npm-debug.log
Found npm debug log, make sure the path matches with the one in npm's output: d:\a\1\s\src\Cranalytics\npm-debug.log
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'test-single-run' ]
2 info using npm@3.10.10
3 info using node@v6.10.0
4 verbose run-script [ 'pretest-single-run',
4 verbose run-script 'test-single-run',
4 verbose run-script 'posttest-single-run' ]
5 info lifecycle Cranalytics@1.0.0~pretest-single-run: Cranalytics@1.0.0
6 silly lifecycle Cranalytics@1.0.0~pretest-single-run: no script for pretest-single-run, continuing
7 info lifecycle Cranalytics@1.0.0~test-single-run: Cranalytics@1.0.0
8 verbose lifecycle Cranalytics@1.0.0~test-single-run: unsafe-perm in lifecycle true
9 verbose lifecycle Cranalytics@1.0.0~test-single-run: PATH: C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;d:\a\1\s\src\Cranalytics\node_modules\.bin;C:\LR\mms\Services\Mms\Provisioner\TaskAgent\agents\2.119.1\externals\git\cmd;C:\Program Files\Microsoft
MPI\Bin\;C:\Program Files (x86)\Python36-32\Scripts\;C:\Program Files (x86)\Python36-32\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Program
Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\Xoreax\IncrediBuild;C:\Program Files (x86)\GtkSharp\2.12\bin;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Program
Files\nodejs\;C:\Users\VssAdministrator\AppData\Local\Microsoft\WindowsApps;;C:\Program Files\Docker;C:\NPM\Modules;;C:\Program Files\Git LFS;C:\Program Files\CMake\bin;C:\java\ant\apache-ant-1.9.7\bin;C:\java\mav...
10 verbose lifecycle Cranalytics@1.0.0~test-single-run: CWD: d:\a\1\s\src\Cranalytics
11 silly lifecycle Cranalytics@1.0.0~test-single-run: Args: [ '/d /s /c', 'karma start wwwroot/karma.conf.js --single-run' ]
12 silly lifecycle Cranalytics@1.0.0~test-single-run: Returned: code: 1 signal: null
13 info lifecycle Cranalytics@1.0.0~test-single-run: Failed to exec test-single-run script
14 verbose stack Error: Cranalytics@1.0.0 test-single-run: `karma start wwwroot/karma.conf.js --single-run`
14 verbose stack Exit status 1
14 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:255:16)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at EventEmitter.emit (events.js:191:7)
14 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:40:14)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at ChildProcess.emit (events.js:191:7)
14 verbose stack at maybeClose (internal/child_process.js:877:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid Cranalytics@1.0.0
16 verbose cwd d:\a\1\s\src\Cranalytics
17 error Windows_NT 10.0.14393
18 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "test-single-run"
19 error node v6.10.0
20 error npm v3.10.10
21 error code ELIFECYCLE
22 error Cranalytics@1.0.0 test-single-run: `karma start wwwroot/karma.conf.js --single-run`
22 error Exit status 1
23 error Failed at the Cranalytics@1.0.0 test-single-run script 'karma start wwwroot/karma.conf.js --single-run'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the Cranalytics package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error karma start wwwroot/karma.conf.js --single-run
23 error You can get information on how to open an issue for this project with:
23 error npm bugs Cranalytics
23 error Or if that isn't available, you can get their info via:
23 error npm owner ls Cranalytics
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]
Error: C:\Program Files\nodejs\npm.cmd failed with return code: 1
系统路径:
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\ProgramFiles(x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\;C:\ProgramFiles(x86)\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\ProgramFiles(x86)\Microsoft SQL Server\110\DTS\Binn\;%USERPROFILE%.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\ProgramFiles\Git\cmd;C:\ProgramFiles(x86)\Microsoft ASP.NET\ASP.NET网页\v1.0\;C:\Program Files\dotnet\您不能在托管代理上运行karma jasmine测试。您需要设置专用生成代理
请参阅本文以设置专用生成代理,这很简单:无法在托管代理中运行JS测试?@PaulCavacas需要与浏览器交互的是karma jasmine测试,需要专用生成代理。如果它只是JS的单元测试,那么您可以在托管代理中运行它。我有一个私有代理设置,并且刚刚将VS2017安装到该框中。然后,我尝试将构建排队到该私有代理(当前未进行Karma测试的构建)中,当它运行指向csproj文件的dotnet.exe restore命令时,我收到一个错误。你知道我还需要做什么才能完成这项工作吗?@PaulCavacas详细的错误信息是什么?你需要安装我已经安装了VS 2017。为了确定我从上面的链接安装了SDK,并且它已经安装好了(在安装中说是修复/卸载)。我已将错误消息添加到上述问题中
2017-07-12T13:21:01.1976623Z [command]C:\dbagent\bin\dotnet.exe restore C:\dbagent\_work\2\s\Cranalytics.Tests\Cranalytics.Tests.csproj
2017-07-12T13:21:01.2757797Z ##[error]Unable to process command '##vso[task.complete ]Dotnet command failed with non-zero exit code: 2147516564.' successfully. Please reference documentation (http://go.microsoft.com/fwlink/?LinkId=817296)
2017-07-12T13:21:01.2757797Z ##[error]Command doesn't have valid result value.
2017-07-12T13:21:01.3695338Z [command]C:\dbagent\bin\dotnet.exe restore C:\dbagent\_work\2\s\src\Cranalytics\Cranalytics.csproj
2017-07-12T13:21:01.3695338Z ##[error]Unable to process command '##vso[task.complete ]Dotnet command failed with non-zero exit code: 2147516564.' successfully. Please reference documentation (http://go.microsoft.com/fwlink/?LinkId=817296)
2017-07-12T13:21:01.3695338Z ##[error]Command doesn't have valid result value.