Topic: navbar module in karma test

jimsgroup pro asked 7 years ago


I've just upgrading to MDB pro and I have karma tests that import NavbarModule.

import { NavbarModule } from 'ng-mdb-pro/free/navbars/navbar.module';
...
imports: [
 NavbarModule,
 MDBBootstrapModules.forRoot()
 ],

My test worked prior to changing to pro. I now get this error when trying to run my tests

ERROR in ./node_modules/ng-mdb-pro/free/navbars/navbar.module.ts
Module build failed: Error: D:XXXnode_modulesng-mdb-profreenavbarsnavbar.module.ts is not part of the compilation output. Please check the other error messages for details.
 at AngularCompilerPlugin.getCompiledFile (D:XXXnode_modules@ngtoolswebpacksrcangular_compiler_plugin.js:625:23)
 at plugin.done.then (D:XXXnode_modules@ngtoolswebpacksrcloader.js:467:39)
 at <anonymous>
 at process._tickCallback (internal/process/next_tick.js:188:7)
 @ ./src/app/app.component.spec.ts 20:22-70
 @ ./src .spec.ts$
 @ ./src/test.ts

ERROR in ./node_modules/ng-mdb-pro/index.ts
Module build failed: Error: D:XXXnode_modulesng-mdb-proindex.ts is not part of the compilation output. Please check the other error messages for details.
 at AngularCompilerPlugin.getCompiledFile (D:XXXnode_modules@ngtoolswebpacksrcangular_compiler_plugin.js:625:23)
 at plugin.done.then (D:XXXnode_modules@ngtoolswebpacksrcloader.js:467:39)
 at <anonymous>
 at process._tickCallback (internal/process/next_tick.js:188:7)
 @ ./src/app/app.component.spec.ts 19:19-40
 @ ./src .spec.ts$
 @ ./src/test.ts

 

 

So I removed the NavbarModule imports from my *.spec.ts files and I now get this error:

ERROR in ./node_modules/ng-mdb-pro/index.ts
Module build failed: Error: D:XXXnode_modulesng-mdb-proindex.ts is not part of the compilation output. Please check the other error messages for details.
 at AngularCompilerPlugin.getCompiledFile (D:XXXnode_modules@ngtoolswebpacksrcangular_compiler_plugin.js:625:23)
 at plugin.done.then (D:XXXnode_modules@ngtoolswebpacksrcloader.js:467:39)
 at <anonymous>
 at process._tickCallback (internal/process/next_tick.js:188:7)
 @ ./src/app/app.component.spec.ts 19:19-40 20:19-40
 @ ./src .spec.ts$
 @ ./src/test.ts

 

Do you have any suggestions as to what is happening here? I had to upgrade my angular version to 5, Could that be causing this? If so, Can I use MDB Pro Angular 4.4.X?

And my tsconfig.json looks like this:

{
 "compileOnSave": false,
 "compilerOptions": {
 "outDir": "./dist/out-tsc",
 "sourceMap": true,
 "declaration": false,
 "moduleResolution": "node",
 "emitDecoratorMetadata": true,
 "experimentalDecorators": true,
 "target": "es5",
 "typeRoots": [
 "node_modules/@types"
 ],
 "lib": [
 "es2017",
 "dom"
 ]
 },
 "include": ["node_modules/ng-mdb-pro/**/*.ts", "src/**/*.ts"]
}

Dawid Adach pro answered 7 years ago


Dear , could you please try removing navbar module and leave only:
import { MDBBootstrapModule } from './typescripts/free';

import { MDBBootstrapModulePro } from './typescripts/pro/index';
+ keep your tsconfig updated with:
 "include": ["node_modules/ng-mdb-pro/**/*.ts", "src/**/*.ts"]
MDBootstrapModule includes all components, there is no need to import them separately.

Please insert min. 20 characters.

FREE CONSULTATION

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

Status

Answered

Specification of the issue

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