Topic: Jasmine | ERROR in ./node_modules/ng-mdb-pro/pro/alerts/toast/toast.service.ts

Bill Bensing pro asked 4 years ago


I'm trying to run unit tests with Jasmine and Karma.  This error keeps popping up.  I added "ng-mdb-pro/pro/alerts/toast/toast.service.ts" to the tsconfig.json for includes and files, but still get the same thing.  Anyone know a fix for this?   ERROR in ./node_modules/ng-mdb-pro/pro/alerts/toast/toast.service.ts Module build failed: Error: .../maker-angular-app/node_modules/ng-mdb-pro/pro/alerts/toast/toast.service.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property. The missing file seems to be part of a third party library. TS files in published libraries are often a sign of a badly packaged library. Please open an issue in the library repository to alert its author and ask them to package the library using the Angular Package Format (https://goo.gl/jB3GVv).

Damian Gemza staff commented 4 years ago

Dear Bill, For ng-mdb-pro repository you have to add "include" in your tsconfig.json file to include the whole ng-mdb-pro directory: "include": ["node_modules/ng-mdb-pro/**/*.ts", "src/**/*.ts"], Also in every component which you're testing, you have to import MDB Angular module in it. Best Regards, Damian

Bill Bensing pro commented 4 years ago

Damian, thank you. I was able to resolve this, but in a different way. I started out having the app configured as you stated. What I observed was that I could not get all of the functionality of your framework. For example, I also had to add the .../toaster.module.ts to get the toasters to work. To resolve this, I added the following to the tsconfig.app.json (i'm using Angular CLI): "files": [ "../node_modules/ng-mdb-pro/index.ts" ], "include": [ "**/*.ts", "../node_modules/angular-bootstrap-md/index.ts", "../node_modules/ng-mdb-pro/**/*.ts"] After doing this, the testing error went away, and I was able to remove the .../toaster.module.ts from the tsconfig.json as well. NOTE: As you stated, I still need to include the MDB Angular Module in each component. Thank you for your follow up!


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Resolved

Specification of the issue

  • User: Pro
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No
Tags