locked
Adding npm tests to Build fails RRS feed

  • Question

  • I have a build pipeline that works which contains the following steps

    1. .NET Core Restore
    2. .NET Core Build
    3. .NET Core Test
    4. Publish Test Results
    5. .Net Core Publish

    Now I want to add a couple of additional steps to run the NPM tests.  I have a package.json that defines all of the typical commands, including test and test-single-run.  It has references to jasmine-core, karma, etc.  I can post full files if someone wants to see them.  From the command line on my machine I can run the npm run test-single-run command and it works and executes the tests as expected.

    I added 3 steps to the build pipeline above after step 4, 2 NPM steps and another Publish Test Results (don't know if/how this works with 3 different sources, but that is not my problem right now).

    The first NPM step runs the command install and has the Working folder with package.json as src/Cranalytics.  
    The second NPM step runs custom with the command line arguments of run test-single-run and also has the same Working folder specified.

    The first NPM command runs without any errors and I can see it pull down a bunch of stuff.  The second one errors with the following:

    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
    07 07 2017 15:13:06.270:WARN [watcher]: Pattern "d:/a/1/s/src/Cranalytics/wwwroot/lib/ngInfiniteScroll/build/ng-infinite-scroll.min.js" does not match any file.
    07 07 2017 15:13:06.759:INFO [karma]: Karma v1.7.0 server started at http://0.0.0.0:9876/
    07 07 2017 15:13:06.760:INFO [launcher]: Launching browser Chrome with unlimited concurrency
    07 07 2017 15:13:06.769:INFO [launcher]: Starting browser Chrome
    07 07 2017 15:14:06.773:WARN [launcher]: Chrome have not captured in 60000 ms, killing.
    07 07 2017 15:14:08.777:WARN [launcher]: Chrome was not killed in 2000 ms, sending SIGKILL.
    07 07 2017 15:14:10.778:WARN [launcher]: Chrome 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

    Friday, July 7, 2017 3:17 PM

Answers