业力失败返回错误,没有详细信息

时间:2018-08-26 18:27:40

标签: angular karma-runner karma-mocha karma-webpack

我有一个使用Angular + Karma + Mocha的angular CLI项目。当我运行ng test的源代码转换时,服务器启动,浏览器打开,然后出现以下错误。

  • 有人看到过类似的错误,可以就如何从业力中获取更多信息提供建议吗?目的是获得足够的信息来解决错误。

错误日志

> ng test

 10% building modules 1/1 modules 0 active26 08 2018 13:32:04.411:WARN [karma]: No captured browser, open http://localhost:9876/
26 08 2018 13:32:04.436:INFO [karma]: Karma v1.7.1 server started at http://0.0.0.0:9876/
26 08 2018 13:32:04.436:INFO [launcher]: Launching browser Chrome with unlimited concurrency
26 08 2018 13:32:04.469:INFO [launcher]: Starting browser Chrome                                              26 08 2018 13:32:17.506:WARN [karma]: No captured browser, open http://localhost:9876/ 
26 08 2018 13:32:18.133:INFO [Chrome 63.0.3239 (Linux 0.0.0)]: Connected on socket EYt3EqLcRZuWnSb2AAAA with id 50438044

START:
Chrome 63.0.3239 (Linux 0.0.0) ERROR
  {
    "isTrusted": true
  }

Chrome 63.0.3239 (Linux 0.0.0) ERROR
  {
    "isTrusted": true
  }


Finished in 0.728 secs / 0 secs @ 13:32:18 GMT-0400 (EDT)

SUMMARY:
✔ 0 tests completed

其他上下文

  • 应用程序可以按预期运行ng serve
  • 我将测试运行器换成wallabyJS,并且测试按预期执行
  • 在不使用角度CLI的情况下运行Karma的结果与ng test
  • 相同
  • 按照delete node_modules solution删除了node_modules

看来这完全是业障配置错误。

业力会议

module.exports = function (config) {
  config.set({
    basePath: '',
    frameworks: ['mocha', '@angular-devkit/build-angular'],
    plugins: [
      'karma-mocha',
      'karma-chai',
      'karma-sinon',
      'karma-sinon-chai',
      'karma-chrome-launcher',
      'karma-phantomjs-launcher',
      'karma-mocha-reporter',
      'karma-coverage-istanbul-reporter',
      'karma-istanbul-threshold',
      '@angular-devkit/build-angular/plugins/karma'
    ],
    client: {
      clearContext: false // leave Jasmine Spec Runner output visible in browser
    },
    files: [
      { pattern: '../node_modules/sinon/pkg/sinon.js', instrument: false },
      { pattern: '../node_modules/chai/chai.js', instrument: false },
      { pattern: '../node_modules/sinon-chai/lib/sinon-chai.js', instrument: false },
      { pattern: 'test.ts', watched: false }
    ],
    mime: {
      'text/x-typescript': ['ts','tsx']
    },
    coverageIstanbulReporter: {
      dir: require('path').join(__dirname, '../coverage'),
      reports: [ 'html', 'lcovonly', 'json' ],
      fixWebpackSourcePaths: true
    },
    istanbulThresholdReporter: {
      src: 'coverage/coverage-final.json',
      reporters: ['text'],
      thresholds: {
        global: {
          statements: 89.57,
          branches: 63.89,
          lines: 87.5,
          functions: 91.89
        },
        each: {
          statements: 45.45,
          branches: 0,
          lines: 40,
          functions: 60
        }
      }
    },
    // reporters: ['progress', 'mocha'],
    reporters: config.angularCli && config.angularCli.codeCoverage
              ? ['progress', 'coverage-istanbul', 'istanbul-threshold']
              : ['progress', 'mocha'],
    port: 9876,
    colors: true,
    logLevel: config.LOG_INFO,
    autoWatch: true,
    browsers: ['Chrome'],
    singleRun: false
  });
};

package.json

{
  "name": "arranbartish-angular-cli-widgets",
  "version": "4.3.0",
  "license": "MIT",
  "description": "UI widgets for Dan produced for use with angular2 SPA's",
  "homepage": "https://github.com/arranbartish/angular-cli-widgets",
  "author": "Arran Bartish <arranbartish@hotmail.com> (https://ca.linkedin.com/in/arran-bartish-7720a21)",
  "engines": {
    "node": ">=6.1"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/arranbartish/angular-cli-widgets.git"
  },
  "contributors": [],
  "keywords": [
    "angular",
    "widget",
    "angular-cli",
    "library",
    "component"
  ],
  "bugs": {
    "url": "https://github.com/arranbartish/angular-cli-widgets/issues",
    "email": "arranbartish@hotmail.com"
  },
  "scripts": {
    "clean-styles-artifacts": "rimraf styles-artifacts",
    "clean-aot": "rimraf aot",
    "clean-dist": "rimraf dist",
    "clean": "npm run clean-aot && npm run clean-dist && npm run clean-styles-artifacts",
    "karma": "karma",
    "ng": "ng",
    "gulp": "gulp",
    "start": "ng serve",
    "build": "npm run clean-dist && ng build",
    "test": "ng test",
    "lint": "npm run ng lint",
    "pree2e": "webdriver-manager update --versions.chrome=2.28",
    "e2e": "ng e2e --webdriver-update false",
    "approval-style": "rimraf styles-artifacts/baseline-repo/styles-artifacts && gulp --gulpfile style-test-gulpfile.js && cd styles-artifacts/baseline-repo && npm prune && npm install && npm run-script style-test &&  cp -R styles-artifacts/comparisons ../",
    "style-test": "SUITE_LOCATION=styles npm run e2e --webdriver-update false",
    "transpile": "ngc -p tsconfig.aot.json",
    "rollup": "rollup -c",
    "minify": "uglifyjs aot/bundles/arranbartishAngularCliWidgets.umd.js --screw-ie8 --compress --mangle --comments --output aot/bundles/arranbartishAngularCliWidgets.umd.min.js",
    "package": "npm run clean-aot && npm run transpile && gulp && npm run rollup && npm run minify"
  },
  "private": false,
  "dependencies": {
    "@angular/animations": "^6.1.0",
    "@angular/cdk": "^6.4.5",
    "@angular/common": "^6.1.0",
    "@angular/compiler": "^6.1.0",
    "@angular/core": "^6.1.0",
    "@angular/flex-layout": "^6.0.0-beta.17",
    "@angular/forms": "^6.1.0",
    "@angular/http": "^6.1.0",
    "@angular/material": "^6.4.5",
    "@angular/platform-browser": "^6.1.0",
    "@angular/platform-browser-dynamic": "^6.1.0",
    "@angular/router": "^6.1.0",
    "@ngrx/store": "^6.1.0",
    "core-js": "^2.5.4",
    "lodash": "^4.17.4",
    "rxjs": "^6.0.0",
    "zone.js": "~0.8.26"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.7.0",
    "@angular/cli": "~6.1.4",
    "@angular/compiler-cli": "^6.1.0",
    "@angular/language-service": "^6.1.0",
    "@types/chai-as-promised": "0.0.30",
    "@types/chai-string": "^1.1.30",
    "@types/mocha": "^2.2.40",
    "@types/node": "~8.9.4",
    "@types/sinon": "^2.1.2",
    "@types/sinon-chai": "^2.7.27",
    "angular2-template-loader": "^0.6.2",
    "chai": "^3.5.0",
    "chai-as-promised": "^6.0.0",
    "chai-string": "^1.3.0",
    "codelyzer": "~4.2.1",
    "electron": "^2.0.8",
    "karma": "~1.7.1",
    "karma-chai": "^0.1.0",
    "karma-chrome-launcher": "^2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.0",
    "karma-istanbul-threshold": "^1.2.2",
    "karma-mocha": "^1.3.0",
    "karma-mocha-reporter": "^2.2.3",
    "karma-phantomjs-launcher": "^1.0.4",
    "karma-sinon": "^1.0.5",
    "karma-sinon-chai": "^1.3.1",
    "mocha": "^3.2.0",
    "protractor": "~5.4.0",
    "protractor-image-comparison": "^1.2.3",
    "rimraf": "^2.6.1",
    "rollup": "^0.41.6",
    "rollup-plugin-commonjs": "^8.0.2",
    "rollup-plugin-node-resolve": "^3.0.0",
    "sinon": "^2.1.0",
    "sinon-chai": "^2.9.0",
    "ts-node": "~5.0.1",
    "tslint": "~5.9.1",
    "typescript": "~2.7.2",
    "wallaby-webpack": "3.9.10"
  }
}

来源

我创建了一个更改集以重现on the branch feature/latest-angular-cli

> git clone https://github.com/arranbartish/angular-cli-widgets.git
> cd angular-cli-widgets
> git checkout 86584d30bc4a498499f76cca4b0b45d55748a225
> npm install
> npm test

0 个答案:

没有答案