0

我使用 Angular 7 创建我的应用程序,这是我的 package.json 片段:

"scripts": {
    "ng": "ng",
    "standardize": "prettier **/*.ts --write",
    "start": "npm run standardize && ng serve --port 5000",
    "build": "npm run standardize && ng build",
    "test:debug": "ng test --source-map=false",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
  },
"dependencies": {
    "@angular/animations": "^7.1.4",
    "@angular/cdk": "~7.2.0",
    "@angular/common": "^7.1.4",
    "@angular/compiler": "^7.1.4",
    "@angular/core": "^7.1.4",
    "@angular/flex-layout": "^7.0.0-beta.22",
    "@angular/forms": "^7.1.4",
    "@angular/http": "^7.1.4",
    "@angular/material": "^7.2.0",
    "@angular/platform-browser": "^7.1.4",
    "@angular/platform-browser-dynamic": "^7.1.4",
    "@angular/router": "^7.1.4",
    "core-js": "^2.6.1",
    "hammerjs": "^2.0.8",
    "rxjs": "~6.3.3",
    "rxjs-tslint": "^0.1.6",
    "zone.js": "~0.8.26"
  },
"devDependencies": {
    "@angular-devkit/build-angular": "^0.8.8",
    "@angular/cli": "^7.1.4",
    "@angular/compiler-cli": "^7.1.4",
    "@angular/language-service": "^7.1.4",
    "@types/jasmine": "^2.8.14",
    "@types/jasminewd2": "^2.0.6",
    "@types/node": "~8.9.4",
    "codelyzer": "~4.3.0",
    "cross-conf-env": "^1.1.2",
    "dev-norms": "1.3.6",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~3.0.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~1.1.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "npm-run-all": "^4.1.5",
    "prettier": "^1.15.3",
    "protractor": "^5.4.2",
    "ts-node": "~7.0.0",
    "tslint": "~5.11.0",
    "typescript": "^3.1.1",
    "webpack-dev-server": "^3.1.14"
  }

是时候做一些测试了,但是当我尝试通过输入终端“npm run e2e”进行测试时,它给了我 0 个反馈,除了这个:

PS E:\dev\local-weather-app> npm run e2e

> localcast-weather@1.1.1 e2e E:\dev\local-weather-app
> ng e2e

PS E:\dev\local-weather-app>

以前我执行过“npm test”并且该命令正常工作

4

1 回答 1

0

如果您尝试运行量角器测试

将以下内容添加到您的package.json

"e2e": "protractor config.js",

然后运行npm run e2e

现在您的测试将运行。

希望对你有帮助

于 2019-01-09T09:07:32.473 回答