lundi 8 février 2021

Im using Angular 9, running ng test gives an error

I am having trouble debugging this issue. Running ng test gives the error: ERROR [config]: Error in config file! { inspect: [Function: inspect] }

I started working on this project recently, it was started 4 years ago which may be causing the issue. Running ng test gives the error above and has never worked, and ran the default test suite.

ng e2e also doesn't work.

I have added various code snippets and relevant info below, please let me know if more would help. Any assistance would be appreciated.

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.900.5
@angular-devkit/build-angular     0.900.5
@angular-devkit/build-optimizer   0.900.5
@angular-devkit/build-webpack     0.900.5
@angular-devkit/core              9.0.5
@angular-devkit/schematics        9.0.5
@angular/cdk                      9.1.2
@ngtools/webpack                  9.0.5
@schematics/angular               9.0.5
@schematics/update                0.900.5
rxjs                              6.5.3
typescript                        3.7.5
webpack                           4.41.2

I am unsure if the e2e folder is used in ng test, it has 3 files:

app.e2e-spec.ts
app.po.ts
tsconfig.json

angular.json testing section

  "test": {
            "builder": "@angular-devkit/build-angular:karma",
            "options": {
            "main": "src/test.ts",
            "karmaConfig": "./karma.conf.js",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "tsconfig.spec.json",
            "styles": [
              "src/assets/css/styles.scss",
              "src/assets/css/swiper.min.css"
            ],
            "scripts": [
              "src/assets/js/AppMeasurement.js"
            ],
            "assets": [
              "src/assets",
              "src/letmein.html",
              "src/favicon.ico",
              "src/403.html",
              "src/405.html",
              "src/robots.txt",
              "src/holding.html"
            ]
          }
        }

tsconfig.json

{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "downlevelIteration": true,
    "experimentalDecorators": true,
    "moduleResolution": "node",
    "importHelpers": true,
    "target": "es2015",
    "module": "esnext",
    "lib": [
      "es2018",
      "dom"
    ]
  }
}

tsconfig.spec.json

{
  "extends": "./tsconfig.json",
  "compilerOptions": {
    "outDir": "./out-tsc/spec",
    "types": [
      "jasmine"
    ]
  },
  "files": [
    "src/test.ts",
    "src/polyfills.ts"
  ],
  "include": [
    "src/**/*.spec.ts",
    "src/**/*.d.ts"
  ]
}

Aucun commentaire:

Enregistrer un commentaire