smnbbrv / ngx-spec

A missing spec generator for Angular CLI
66 stars 8 forks source link

The 'path' option in '/*removed_local_directory*/node_modules/ngx-spec/src/specs/schema.json' is using deprecated behaviour.'workingDirectory' smart default provider should be used instead. #16

Open meisterveda opened 2 years ago

meisterveda commented 2 years ago

Then Running ng g ngx-spec:specs 'components/alerts/* To generate a spec file on a component I received that warning. I also recieved an error calling "Cannot find module '/removed_local_directory/node_modules/@schematics/angular/component/index.js.js'

My package.json


{
  "name": "portfolio",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "watch": "ng build --watch --configuration development",
    "test": "jest",
    "test:watch": "jest --watch",
    "cypress": "cypress run",
    "cypress:open": "cypress open",
    "docs:json": "compodoc -p ./tsconfig.json -e json -d .",
    "storybook": "npm run docs:json && start-storybook -p 6006",
    "build-storybook": "npm run docs:json && build-storybook"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^14.1.0",
    "@angular/common": "^14.1.0",
    "@angular/compiler": "^14.1.0",
    "@angular/core": "^14.1.0",
    "@angular/forms": "^14.1.0",
    "@angular/platform-browser": "^14.1.0",
    "@angular/platform-browser-dynamic": "^14.1.0",
    "@angular/router": "^14.1.0",
    "rxjs": "~7.5.0",
    "tslib": "^2.3.0",
    "zone.js": "~0.11.4"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^14.1.1",
    "@angular/cli": "~14.1.1",
    "@angular/compiler-cli": "^14.1.0",
    "@babel/core": "^7.18.10",
    "@compodoc/compodoc": "^1.1.19",
    "@storybook/addon-actions": "^6.5.10",
    "@storybook/addon-essentials": "^6.5.10",
    "@storybook/addon-interactions": "^6.5.10",
    "@storybook/addon-links": "^6.5.10",
    "@storybook/angular": "^6.5.10",
    "@storybook/builder-webpack5": "^6.5.10",
    "@storybook/manager-webpack5": "^6.5.10",
    "@storybook/testing-library": "^0.0.13",
    "@types/jest": "^28.1.7",
    "autoprefixer": "^10.4.8",
    "babel-loader": "^8.2.5",
    "cypress": "^10.5.0",
    "jest": "^28.1.3",
    "jest-preset-angular": "^12.2.0",
    "ngx-spec": "^2.1.5",
    "postcss": "^8.4.16",
    "tailwindcss": "^3.1.8",
    "typescript": "~4.7.2"
  }
}```
dickerpulli commented 2 years ago

Same problem on my site after upgrading to Angular 14.

meisterveda commented 2 years ago

Same problem on my site after upgrading to Angular 14.

I found that at least with the latest Angular if you re-run the components generator it will update and add the spec file. Make sure in the configuration you have it so it will create the file.

dickerpulli commented 2 years ago

@meisterveda What do you mean by "Make sure in the configuration you have it" ?

meisterveda commented 2 years ago

I believe is in the angular.json, you will see a part, under schematics that will say something along the lines of skipTest: true, change that to false or just remove the lines.

mgsfan commented 1 year ago

@meisterveda: Can we get an example please?

meisterveda commented 1 year ago

https://upmostly.com/angular/skipping-tests-in-angular-cli

This article shows how to skip them, if you have that line as false it will create them