首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >角7: ng测试挂起,反复运行测试。

角7: ng测试挂起,反复运行测试。
EN

Stack Overflow用户
提问于 2019-02-01 15:27:52
回答 2查看 9.8K关注 0票数 13

最近,我将我的角6应用程序迁移到了角7

我的package.json如下所示:

代码语言:javascript
运行
复制
{
  "name": "myApp",
  "version": "3.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve --public-host http://localhost:4200/",
    "build": "ng build --prod",
    "serve": "ng serve --optimization=true --source-map=true --eval-source-map=true --live-reload=true --aot=false --vendor-chunk=true",
    "build-prod": "node --max_old_space_size=5000 ./node_modules/.bin/ng build --configuration=production",
    "build-localProd": "node --max_old_space_size=5000 ./node_modules/.bin/ng build --configuration=localProduction",
    "build-dev": "node --max_old_space_size=7000 ./node_modules/.bin/ng build --configuration=development",
    "test": "ng test --source-map=false --watch=false --code-coverage",
    "test-headless": "ng test --browsers=ChromeHeadless --watch=false --code-coverage",
    "doc": "compodoc -p src/tsconfig.app.json -s --port 8081",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "sonar-scanner": "node_modules/sonar-scanner/bin/sonar-scanner"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^7.2.2",
    "@angular/cdk": "7.2.2",
    "@angular/common": "^7.2.2",
    "@angular/compiler": "^7.2.2",
    "@angular/core": "^7.2.2",
    "@angular/flex-layout": "^7.0.0-beta.23",
    "@angular/forms": "^7.2.2",
    "@angular/http": "^7.2.2",
    "@angular/material": "7.2.2",
    "@angular/platform-browser": "^7.2.2",
    "@angular/platform-browser-dynamic": "^7.2.2",
    "@angular/platform-server": "^7.2.2",
    "@angular/router": "^7.2.2",
    "@auth0/angular-jwt": "2.1.0",
    "@compodoc/compodoc": "^1.1.7",
    "@types/bootstrap": "4.2.1",
    "angular-user-idle": "^2.0.0",
    "bootstrap": "4.2.1",
    "classlist.js": "^1.1.20150312",
    "core-js": "^2.6.3",
    "devextreme": "^18.2.4",
    "devextreme-angular": "^18.2.4",
    "es5-shim": "^4.5.10",
    "jquery": "^3.3.1",
    "moment": "^2.18.1",
    "ngx-bootstrap": "3.2.0",
    "ngx-cookie-service": "2.1.0",
    "ngx-device-detector": "1.3.5",
    "ngx-logger": "3.3.11",
    "ngx-spinner": "7.0.0",
    "popper.js": "1.14.6",
    "proxy-polyfill": "^0.1.7",
    "rxjs": "^6.3.3",
    "sha1": "^1.1.1",
    "web-animations-js": "^2.3.1",
    "zone.js": "^0.8.29"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^0.12.4",
    "@angular/cli": "^7.2.3",
    "@angular/compiler-cli": "^7.2.2",
    "@angular/language-service": "^7.2.2",
    "@types/jasmine": "^3.3.7",
    "@types/jasminewd2": "~2.0.2",
    "@types/jquery": "^3.3.1",
    "@types/node": "^10.12.18",
    "codelyzer": "^4.5.0",
    "jasmine-core": "^3.3.0",
    "jasmine-spec-reporter": "^4.2.1",
    "karma": "^4.0.0",
    "karma-chrome-launcher": "^2.2.0",
    "karma-cli": "^2.0.0",
    "karma-coverage-istanbul-reporter": "2.0.4",
    "karma-jasmine": "^2.0.1",
    "karma-jasmine-html-reporter": "^1.4.0",
    "protractor": "^5.4.2",
    "rxjs-tslint": "^0.1.6",
    "sonar-scanner": "^3.1.0",
    "ts-node": "~4.1.0",
    "tslint": "^5.12.1",
    "typescript": "^3.2.4"
  }
}

奇怪的是当你跑的时候:ng test --watch=false --code-coverage

服务器不确定地继续运行和重新运行测试,不停止,也不生成覆盖率文件。

这个问题似乎很奇怪

建议??

EN

回答 2

Stack Overflow用户

发布于 2019-03-11 13:45:54

尝试以下命令ng test -- --watch=false --code-coverage

票数 12
EN

Stack Overflow用户

发布于 2019-03-05 22:00:30

我也遇到了类似的问题,我发现在Range7中,当您运行ng test而没有指定特定的项目时,它会为angular.json工作区文件中的所有项目运行测试,而不仅仅是主应用程序。然后,它看起来像无限期地继续下去,或者有一个bug,它循环项目。

试着运行ng test <projectname>,看看是否还能得到相同的结果。对我来说,这解决了这个问题。

这里还有一个指向正式文件的链接,它在命令的描述中解释了它。

票数 8
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54482449

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档