如何查看更多描述性/有意义的错误“在SQL控制台cmd中抛出所有\ nUncaught [object Object]后出现错误”

问题描述 投票:2回答:1

我一直在研究这个问题,但是无法找到下面的任何解决方案是我在Continues Integration构建命令提示符下运行ng测试构建时得到的错误。

"message": "An error was thrown in afterAll\nUncaught [object Object] thrown",
"str": "An error was thrown in afterAll\nUncaught [object Object] thrown"

下面是我的karma config.js:

module.exports = function (config) {
config.set({
basePath: '',
frameworks: [
  'jasmine', '@angular-devkit/build-angular'
],
plugins: [
  require('karma-jasmine'),
  require('karma-chrome-launcher'),
  require('karma-jasmine-html-reporter'),
  require('karma-coverage-istanbul-reporter'),
  require('@angular-devkit/build-angular/plugins/karma'),
  require('karma-trx-reporter')
],
client: {
  clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
  dir: require('path').join(__dirname, '../coverage'),
  reports: [
    'html', 'lcovonly', 'cobertura'
  ],
  fixWebpackSourcePaths: true
},
junitReporter: {
  outputDir: require('path').join(__dirname, '../coverage'),
  outputFile: 'cobertura-coverage.xml'
},
reporters: [
  'progress', 'kjhtml', 'trx'
],
// the default configuration
trxReporter: {
  outputFile: 'test-results.xml',
  shortTestName: false
},
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false
});
};

下面是我的Package.json:

{  
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test --code-coverage --watch=false --browsers=ChromeHeadless",
"lint": "ng lint",
"e2e": "ng e2e",             
 },   
"private": true,
"dependencies": {
"@angular/animations": "^7.1.0",
"@angular/common": "^7.1.0",
"@angular/compiler": "^7.1.0",
"@angular/core": "^7.1.0",
"@angular/forms": "^7.1.0",
"@angular/http": "^7.1.0",
"@angular/platform-browser": "^7.1.0",
"@angular/platform-browser-dynamic": "^7.1.0",
"@angular/router": "^7.1.0",
"@ng-bootstrap/ng-bootstrap": "^4.0.1",
"@types/applicationinsights-js": "^1.0.7",
"applicationinsights-js": "^1.0.20",
"core-js": "^2.5.7",
"moment": "^2.22.2",
"moment-es6": "^1.0.0",
"oidc-client": "^1.5.4",
"rxjs": "^6.3.3",
"rxjs-compat": "^6.3.3",
"zone.js": "^0.8.26"
 },
 "devDependencies": {
"@angular-devkit/build-angular": "^0.13.1",
"@angular/cli": "^7.0.4",
"@angular/compiler-cli": "^7.1.0",
"@angular/language-service": "^7.1.0",
"@types/jasmine": "^3.3.0",
"@types/jasminewd2": "^2.0.6",
"@types/node": "^10.12.10",
"codelyzer": "~4.5.0",
"jasmine-core": "~3.3.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~3.1.1",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.0",
"karma-jasmine": "^2.0.1",
"karma-jasmine-html-reporter": "^1.4.0",
"karma-junit-reporter": "^1.2.0",
"karma-trx-reporter": "^0.4.0",
"protractor": "^5.4.1",
"ts-node": "~7.0.1",
"tslint": "~5.11.0",
"tslint-consistent-codestyle": "^1.14.1",
"tslint-defocus": "^2.0.5",
"tslint-eslint-rules": "^5.4.0",
"tslint-origin-ordered-imports-rule": "^1.1.2",
"tslint-rxjs-subject-restrictions-rule": "^1.0.4",
"tslint-sonarts": "^1.8.0",
"typescript": "3.2.4",
"webpack-dev-server": "^3.1.10"
}
}

如何记录导致此问题的特定文件名,因为查看此错误很难调试。任何建议都非常感谢。而且我也知道在本地我没有看到任何这样的错误在运行“ng test”/“npm run package”(无头镀铬)时。但我只能在持续集成构建控制台命令提示符中看到此错误。

jasmine karma-jasmine angular7
1个回答
0
投票

即使我没有遇到类似问题,当我们在本地运行测试时,问题也会间歇性地发生。以下链接有助于解决问题。

Karma Start Fails - HeadlessChrome - ERROR Uncaught [object Object]

© www.soinside.com 2019 - 2024. All rights reserved.