briebug / jest-schematic

Angular schematic for adding Jest and the required files to an Angular CLI project
MIT License
318 stars 39 forks source link

BUG: Cannot destructure property 'test' of '(intermediate value)(intermediate value)(intermediate value)' as it is undefined. #66

Open Luguito opened 3 years ago

Luguito commented 3 years ago

Hello everyone!

I try to used you schematic but he fired a bug error and i dont get it.

Cannot destructure property 'test' of '(intermediate value)(intermediate value)(intermediate value)' as it is undefined.

*To Reproduce Just doing ng add @briebug/jest-schematic

This is my tsconfig.spec.json

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

This is my tsconfig.json

{
  "compileOnSave": false,
  "compilerOptions": {
    "skipLibCheck": true,
    "types": [
      "heremaps",
      "google.maps"
    ],
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es2015",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2017",
      "dom"
    ],
    "module": "es2020",
    "baseUrl": "./"
  },
  "exclude": [
    "dist"
  ],
  "include": [
    "node_modules/ng-autosize/**/*.ts",
    "node_modules/ng2-datetime/ng2-datetime.ts",
    "node_modules/ng2-datetime/src/ng2-datetime/ng2-datetime.module.ts",
    "node_modules/ng2-datetime/src/ng2-datetime/ng2-datetime.ts",
    "**/*.ts"
  ],
}

Expected behavior Well i expect the normal behavior, delete/remove karma files/dependecies and install jest

Desktop (please complete the following information):

Additional context I need your heeeelp.

Thank you so much!

schuchard commented 2 years ago

Hi, in this example do you have the test field in your angular.json file at projects.[projectName].architect.test?

Luguito commented 2 years ago
{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "Sing": {
      "root": "",
      "sourceRoot": "src",
      "projectType": "application",
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "aot": true,
            "outputPath": "dist",
            "index": "src/index.html",
            "main": "src/main.ts",
            "tsConfig": "tsconfig.app.json",
            "polyfills": "src/polyfills.ts",
            "assets": [
              "src/assets",
              "src/assets/img/dexfreight/newlogo/new-imagotipo.ico"
            ],
            "styles": [
              "src/assets/css/animate.min.css",
              "src/assets/scss/dexcss.scss",
              "src/assets/scss/application.scss",
              "node_modules/colina-css/dist/css/colina.min.css",
              "node_modules/intro.js/minified/introjs.min.css",
              "node_modules/intro.js/themes/introjs-modern.css",
              "node_modules/angular-resize-element/bundles/style.scss"
            ],
            "scripts": [
              "node_modules/jquery/dist/jquery.js",
              "node_modules/intro.js/intro.js",
              "node_modules/popper.js/dist/umd/popper.js",
              "node_modules/bootstrap/dist/js/bootstrap.js",
              "node_modules/webpack-raphael/raphael-min.js",
              "node_modules/d3/d3.min.js",
              "node_modules/nvd3/build/nv.d3.min.js",
              "node_modules/rickshaw/rickshaw.min.js",
              "node_modules/moment/min/moment.min.js",
              "node_modules/dropzone/dist/dropzone.js",
              "node_modules/parsleyjs/dist/parsley.js",
              "node_modules/jasny-bootstrap/dist/js/jasny-bootstrap.min.js",
              "node_modules/markdown/lib/markdown.js",
              "node_modules/bootstrap-markdown/js/bootstrap-markdown.js",
              "node_modules/bootstrap-slider/dist/bootstrap-slider.js",
              "node_modules/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js",
              "node_modules/bootstrap-timepicker/js/bootstrap-timepicker.min.js",
              "node_modules/bootstrap-colorpicker/dist/js/bootstrap-colorpicker.min.js",
              "node_modules/select2/dist/js/select2.min.js",
              "node_modules/bootstrap-select/dist/js/bootstrap-select.js",
              "node_modules/easy-pie-chart/dist/jquery.easypiechart.js",
              "node_modules/jquery-ui/ui/core.js",
              "node_modules/jquery-ui/ui/widget.js",
              "node_modules/jquery-ui/ui/mouse.js",
              "node_modules/jquery-ui/ui/sortable.js",
              "node_modules/jquery-ui/ui/draggable.js",
              "node_modules/jquery-sparkline/jquery.sparkline.min.js",
              "node_modules/morris.js/morris.js",
              "node_modules/apexcharts/dist/apexcharts.min.js"
            ]
          },
          "configurations": {
            "production": {
              "budgets": [
                {
                  "type": "anyComponentStyle",
                  "maximumWarning": "6kb"
                }
              ],
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ]
            },
            "build": {
              "budgets": [
                {
                  "type": "anyComponentStyle",
                  "maximumWarning": "6kb"
                }
              ],
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": false,
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ]
            },
            "build-dev": {
              "budgets": [
                {
                  "type": "anyComponentStyle",
                  "maximumWarning": "6kb"
                }
              ],
              "optimization": false,
              "outputHashing": "all",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": true,
              "aot": false,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": false,
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.dev.ts"
                }
              ]
            },
            "local": {
              "budgets": [
                {
                  "type": "anyComponentStyle",
                  "maximumWarning": "6kb"
                }
              ],
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.local.ts"
                }
              ]
            },
            "dev": {
              "budgets": [
                {
                  "type": "anyComponentStyle",
                  "maximumWarning": "6kb"
                }
              ],
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.dev.ts"
                }
              ]
            }
          }
        },
        "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "options": {
            "browserTarget": "Sing:build",
            "port": 3000
          },
          "configurations": {
            "production": {
              "browserTarget": "Sing:build:production"
            },
            "build": {
              "browserTarget": "Sing:build:build"
            },
            "local": {
              "browserTarget": "Sing:build:local"
            },
            "dev": {
              "browserTarget": "Sing:build:dev"
            }
          }
        },
        "extract-i18n": {
          "builder": "@angular-devkit/build-angular:extract-i18n",
          "options": {
            "browserTarget": "Sing:build"
          }
        },
        "test": {
          "builder": "@angular-devkit/build-angular:karma",
          "options": {
            "main": "src/test.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "src/tsconfig.spec.json",
            "karmaConfig": "src/karma.conf.js"
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": [
              "src/tsconfig.app.json"
            ],
            "exclude": [
              "**/node_modules/**"
            ]
          }
        }
      }
    },
    "Sing-e2e": {
      "root": "e2e",
      "sourceRoot": "e2e",
      "projectType": "application"
    }
  },
  "defaultProject": "Sing",
  "schematics": {
    "@schematics/angular:component": {
      "prefix": "app",
      "style": "scss"
    },
    "@schematics/angular:directive": {
      "prefix": "app"Ï
    }
  }
}

Hello. Yes i got it.

Thank you for anwser !

🔥

schuchard commented 2 years ago

Great!

Luguito commented 2 years ago

We got a misunderstood, the bug persist. I just show you i got test inside projects.[projectName].architect.

Thank you 🔥

schuchard commented 2 years ago

Sorry, i see now. Is this project public? If not can you create a public version for me to test against?