业力测试参数-Watch = false不起作用



我们有一个问题来运行茉莉测试。如果我们运行:

ng test --browsers=ChromeHeadless --code-coverage

测试正在工作。

,但是如果我们运行:

ng test --watch=false --browsers=ChromeHeadless --code-coverage

它不起作用,我们会收到此错误:

$ npm run test:noWatch
> client@0.0.0 test:noWatch E:JenkinshomeworkspaceMSF-Testmonatlicheschuelerclient
> ng test --watch=false --browsers=ChromeHeadless --code-coverage
14 02 2019 15:28:47.979:INFO [karma]: Karma v3.0.0 server started at http://0.0.0.0:9876/
14 02 2019 15:28:47.995:INFO [launcher]: Launching browser ChromeHeadless with unlimited concurrency
14 02 2019 15:28:48.027:INFO [launcher]: Starting browser ChromeHeadless
14 02 2019 15:29:09.146:INFO [HeadlessChrome 0.0.0 (Windows 8.1 0.0.0)]: Connected on socket 5cSIZU4-5deTyQyKAAAA with id 46249460
14 02 2019 15:29:39.153:WARN [HeadlessChrome 0.0.0 (Windows 8.1 0.0.0)]: Disconnected (1 times), because no message in 30000 ms.
HeadlessChrome 0.0.0 (Windows 8.1 0.0.0) ERROR
  Disconnected, because no message in 30000 ms.
HeadlessChrome 0.0.0 (Windows 8.1 0.0.0) ERROR
  Disconnected, because no message in 30000 ms.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! client@0.0.0 test:noWatch: `ng test --watch=false --browsers=ChromeHeadless --code-coverage`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the client@0.0.0 test:noWatch script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:  

我们正在使用此版本:

Angular CLI: 7.3.1
Node: 10.14.1
OS: win32 x64
Angular: 7.1.4
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.12.4
@angular-devkit/build-angular     0.12.4
@angular-devkit/build-optimizer   0.12.4
@angular-devkit/build-webpack     0.12.4
@angular-devkit/core              7.2.4
@angular-devkit/schematics        7.3.1
@angular/cdk                      7.1.1
@angular/cli                      7.3.1
@angular/material                 7.3.2
@ngtools/webpack                  7.2.4
@schematics/angular               7.3.1
@schematics/update                0.13.1
rxjs                              6.3.3
typescript                        3.1.6
webpack                           4.28.4

这是我在日志中可以找到的:

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:noWatch' ]
2 info using npm@6.4.1
3 info using node@v10.14.1
4 verbose run-script [ 'pretest:noWatch', 'test:noWatch', 'posttest:noWatch' ]
5 info lifecycle client@0.0.0~pretest:noWatch: client@0.0.0
6 info lifecycle client@0.0.0~test:noWatch: client@0.0.0
7 verbose lifecycle client@0.0.0~test:noWatch: unsafe-perm in lifecycle true
8 verbose lifecycle client@0.0.0~test:noWatch: PATH: C:Program Filesnodejsnode_modulesnpmnode_modulesnpm-lifecyclenode-gyp-bin;E:JenkinshomeworkspaceMSF-Testmonatlicheschuelerclientnode_modules.bin;C:Usersadmin2bin;E:Program FilesGitmingw64bin;E:Program FilesGitusrlocalbin;E:Program FilesGitusrbin;E:Program FilesGitusrbin;E:Program FilesGitmingw64bin;E:Program FilesGitusrbin;C:Usersadmin2bin;C:Program Files (x86)Common FilesOracleJavajavapath;C:Windowssystem32;C:Windows;C:WindowsSystem32Wbem;C:WindowsSystem32WindowsPowerShellv1.0;E:Program FilesGitcmd;C:Program Filesnodejs;E:Program Files7-Zip;C:WindowsSystem32;E:Program Filesmavenapache-maven-3.5.4bin;E:Program Filescommons-daemon;E:Program FilesGitusrbin;E:Program FilesGitusrbin;E:Program FilesGitmingw64bin;E:Program FilesJavajdk1.8.0_171bin;C:Usersadmin2AppDataRoamingnpm;E:Program FilesGitusrbinvendor_perl;E:Program FilesGitusrbincore_perl
9 verbose lifecycle client@0.0.0~test:noWatch: CWD: E:JenkinshomeworkspaceMSF-Testmonatlicheschuelerclient
10 silly lifecycle client@0.0.0~test:noWatch: Args: [ '/d /s /c',
10 silly lifecycle   'ng test --watch=false --browsers=ChromeHeadless --code-coverage' ]
11 silly lifecycle client@0.0.0~test:noWatch: Returned: code: 1  signal: null
12 info lifecycle client@0.0.0~test:noWatch: Failed to exec test:noWatch script
13 verbose stack Error: client@0.0.0 test:noWatch: `ng test --watch=false --browsers=ChromeHeadless --code-coverage`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (C:Program Filesnodejsnode_modulesnpmnode_modulesnpm-lifecycleindex.js:301:16)
13 verbose stack     at EventEmitter.emit (events.js:182:13)
13 verbose stack     at ChildProcess.<anonymous> (C:Program Filesnodejsnode_modulesnpmnode_modulesnpm-lifecyclelibspawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:182:13)
13 verbose stack     at maybeClose (internal/child_process.js:962:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
14 verbose pkgid client@0.0.0
15 verbose cwd E:JenkinshomeworkspaceMSF-Testmonatlicheschuelerclient
16 verbose Windows_NT 6.3.9600
17 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "run" "test:noWatch"
18 verbose node v10.14.1
19 verbose npm  v6.4.1
20 error code ELIFECYCLE
21 error errno 1
22 error client@0.0.0 test:noWatch: `ng test --watch=false --browsers=ChromeHeadless --code-coverage`
22 error Exit status 1
23 error Failed at the client@0.0.0 test:noWatch script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

有人知道可能是什么问题吗?

在没有平等的情况下对--watch false进行测试,在版本6中有一段时间的问题,不知道是否固定

问题是超时,我需要将其添加到我的karma.conf.js

captureTimeout: 210000,
browserDisconnectTolerance: 3,
browserDisconnectTimeout : 210000,
browserNoActivityTimeout : 210000

感谢您的所有帮助。:)

最新更新