1

我将项目从 Angular7 升级到 Angular8。(目前,我还没有升级 Nx,当前使用的版本是 "@nrwl/nx": "7.8.7",)

升级后,我的应用程序成功运行(在构建或部署中没有任何问题)。

"codeCoverage": true当我通过放入angular.json 文件运行测试用例时,它失败并抛出错误。

使用的脚本

"test:appone": "ng test --project=app-one --no-watch",

日志

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:one' ]
2 info using npm@6.4.1
3 info using node@v10.15.3
4 verbose run-script [ 'pretest:one', 'test:one', 'posttest:one' ]
5 info lifecycle proj-micro-apps@1.1.0~pretest:one: proj-micro-apps@1.1.0
6 info lifecycle proj-micro-apps@1.1.0~test:one: proj-micro-apps@1.1.0
7 verbose lifecycle proj-micro-apps@1.1.0~test:one: unsafe-perm in lifecycle true
8 verbose lifecycle proj-micro-apps@1.1.0~test:one: PATH: C:\Users\KBharambe\AppData\Roaming\nvm\v10.15.3\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;D:\NX8New\proj-micro-apps\node_modules\.bin;C:\ProgramData\DockerDesktop\version-bin;C:\Program Files\Docker\Docker\Resources\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\1E\NomadBranch\;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\WINDOWS\System32\OpenSSH\;C:\Users\KBharambe\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Users\KBharambe\scoop\apps\maven\current\bin;C:\Users\KBharambe\scoop\shims;C:\Users\KBharambe\.windows-build-tools\python27\;C:\Users\KBharambe\AppData\Local\Continuum\anaconda3;C:\Users\KBharambe\AppData\Local\Continuum\anaconda3\Library\mingw-w64\bin;C:\Users\KBharambe\AppData\Local\Continuum\anaconda3\Library\usr\bin;C:\Users\KBharambe\AppData\Local\Continuum\anaconda3\Library\bin;C:\Users\KBharambe\AppData\Local\Continuum\anaconda3\Scripts;C:\Users\KBharambe\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Microsoft VS Code\bin;C:\Users\KBharambe\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\KBharambe\AppData\Roaming\npm;C:\Users\KBharambe\AppData\Roaming\nvm;C:\Program Files\nodejs
9 verbose lifecycle proj-micro-apps@1.1.0~test:one: CWD: D:\NX8New\proj-micro-apps
10 silly lifecycle proj-micro-apps@1.1.0~test:one: Args: [ '/d /s /c',
10 silly lifecycle   'ng test --project=app-one  --no-watch' ]
11 silly lifecycle proj-micro-apps@1.1.0~test:one: Returned: code: 1  signal: null
12 info lifecycle proj-micro-apps@1.1.0~test:one: Failed to exec test:one script
13 verbose stack Error: proj-micro-apps@1.1.0 test:one: `ng test --project=app-one  --no-watch`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (C:\Users\KBharambe\AppData\Roaming\nvm\v10.15.3\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
13 verbose stack     at EventEmitter.emit (events.js:189:13)
13 verbose stack     at ChildProcess.<anonymous> (C:\Users\KBharambe\AppData\Roaming\nvm\v10.15.3\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:189:13)
13 verbose stack     at maybeClose (internal/child_process.js:970:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid proj-micro-apps@1.1.0
15 verbose cwd D:\NX8New\proj-micro-apps
16 verbose Windows_NT 10.0.17134
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "test:one"
18 verbose node v10.15.3
19 verbose npm  v6.4.1
20 error code ELIFECYCLE
21 error errno 1
22 error proj-micro-apps@1.1.0 test:one: `ng test --project=app-one  --no-watch`
22 error Exit status 1
23 error Failed at the proj-micro-apps@1.1.0 test:one script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

如果我删除"codeCoverage"标志测试用例执行没有任何错误,但我不会得到任何覆盖。

=============================== Coverage summary ===============================
Statements   : Unknown% ( 0/0 )
Branches     : Unknown% ( 0/0 )
Functions    : Unknown% ( 0/0 )
Lines        : Unknown% ( 0/0 )
================================================================================

我正在使用业力茉莉花同样

    "karma": "4.4.1",
    "@types/jasmine": "3.5.0",
    "@types/jasminewd2": "2.0.8",
    "karma-jasmine": "2.0.1",
    "karma-jasmine-html-reporter": "1.4.2",
    "jasmine-core": "3.5.0",
    "jasmine-marbles": "0.6.0",
    "jasmine-reporters": "2.3.2",
    "jasmine-spec-reporter": "4.2.1",
    "karma-chrome-launcher": "3.1.0",
    "karma-cli": "2.0.0",
    "karma-coverage": "2.0.1",
    "karma-coverage-istanbul-reporter": "2.1.1",
    "karma-jasmine": "2.0.1",
    "karma-jasmine-html-reporter": "1.4.2",
    "karma-junit-reporter": "2.0.1",

ng--版本

Angular CLI: 8.3.20
Node: 10.15.3
OS: win32 x64
Angular: 8.2.14
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.803.20
@angular-devkit/build-angular      0.803.21
@angular-devkit/build-ng-packagr   0.803.20
@angular-devkit/build-optimizer    0.803.21
@angular-devkit/build-webpack      0.803.21
@angular-devkit/core               8.3.20
@angular-devkit/schematics         8.3.20
@angular/cdk                       8.2.3
@angular/cli                       8.3.20
@angular/flex-layout               8.0.0-beta.27
@angular/material                  8.2.3
@angular/material-moment-adapter   8.2.3
@ngtools/json-schema               1.1.0
@ngtools/webpack                   8.3.21
@schematics/angular                8.3.20
@schematics/update                 0.803.20
ng-packagr                         5.0.0
rxjs                               6.5.3
typescript                         3.4.5
webpack                            4.39.2

我尝试了多个节点版本,但仍然相同。

你能告诉我可能是什么问题吗?

提前致谢。

4

0 回答 0