Repository navigation
Unexpected value 'KernelModule' imported by the module 'DynamicTestModule' #3463
Description
Please provide us with the following information:
OS?
Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)
Windows 7
Versions.
Please run
ng --version. If there's nothing outputted, please run in a Terminal:node --versionand paste the result here:
$ ng version
angular-cli: 1.0.0-beta.21
node: 6.4.0
os: win32 x64
$ node version
v6.4.0
Repro steps.
Was this an app that wasn't created using the CLI? What change did you do on your code? etc.
Added custom components and custom routings
The log given by the failure.
Chrome 54.0.2840 (Windows 7 0.0.0) Page partenaire list should test true is true FAILED
Failed: Unexpected value 'KernelModule' imported by the module 'DynamicTestModule'
Error: Unexpected value 'KernelModule' imported by the module 'DynamicTestModule'
at webpack:///C:/Develop/partenaire-front-end//@angular/compiler/src/metadata_resolver.js:363:0 <- src/test.ts:26654:31/@angular/compiler/src/metadata_resolver.js:348:0 <- src/test.ts:26639:49)
at Array.forEach (native)
at CompileMetadataResolver._loadNgModuleMetadata (webpack:///C:/Develop/partenaire-front-end/
at CompileMetadataResolver.loadNgModuleMetadata (webpack:///C:/Develop/partenaire-front-end//@angular/compiler/src/metadata_resolver.js:313:0 <- src/test.ts:26604:29)/@angular/compiler/src/runtime_compiler.js:99:0 <- src/test.ts:43055:41)
at RuntimeCompiler._loadModules (webpack:///C:/Develop/partenaire-front-end/
at RuntimeCompiler._compileModuleAndAllComponents (webpack:///C:/Develop/partenaire-front-end//@angular/compiler/src/runtime_compiler.js:83:0 <- src/test.ts:43039:35)/@angular/compiler/src/runtime_compiler.js:65:0 <- src/test.ts:43021:21)
at RuntimeCompiler.compileModuleAndAllComponentsAsync (webpack:///C:/Develop/partenaire-front-end/
at TestingCompilerImpl.compileModuleAndAllComponentsAsync (webpack:///C:/Develop/partenaire-front-end//@angular/compiler/bundles/compiler-testing.umd.js:485:0 <- src/test.ts:65925:35)/@angular/core/bundles/core-testing.umd.js:745:0 <- src/test.ts:14955:35)
at TestBed.compileComponents (webpack:///C:/Develop/partenaire-front-end/
at Function.TestBed.compileComponents (webpack:///C:/Develop/partenaire-front-end/~/@angular/core/bundles/core-testing.umd.js:648:49 <- src/test.ts:14858:71)
Chrome 54.0.2840 (Windows 7 0.0.0): Executed 1 of 1 (1 FAILED) ERROR (0.159 secs / 0.019 secs)
Mention any other details that might be useful.
The KernelModule is for the moment a custom made Angular2 webpack app that we host on Bitbucket, so it's being installed by the other app which is now an angular-cli app. And there I want to perform my UT. This KernelModule will be migrated in the near future to angular-cli too.
The meaning behind KernelModule is that it will share other component.
Metadata for this one is:
@NgModule({
imports: [
CommonModule,
FormsModule,
BrowserModule,
ReactiveFormsModule,
/**
* KendoUI Modules
*/
GridModule
],
declarations: [
KernelBoxComponent,
/**
* Based on KendoUI
*/
KernelTableComponent,
KernelTableHeaderComponent
],
exports: [
CommonModule,
FormsModule,
BrowserModule,
ReactiveFormsModule,
KernelBoxComponent,
/**
* Based on KendoUI
*/
KernelTableComponent,
KernelTableHeaderComponent
]
})
I'm guessing that it could be either because the KernelModule is not build correctly, or (but this is a long shot) KernelModule is for now webpack? I'm thinking about these because once I copied the KernelBoxComponent and pasted into my project and used the component directly instead of the module, there wasn't a problem for doing my tests. BUT when I used the component directly from the my custom made webpack app, then I got other errors.
Thanks! We'll be in touch soon.
Activity
hansl commentedon Dec 8, 2016
What is
DynamicTestModule? It seems you're missing imports or something.serhiisol commentedon Jan 12, 2017
@hansl
DynamicTestModuleis a part of Angular testing bed.I have the same problem, when I'm trying to import 3d party modules from node_modules and trying to test my services.
blingwang commentedon Jan 28, 2017
I used local npm linked lib and got a similar issue like this. The package versions in my project:
The error is:
Unexpected value 'MyCustomLibraryModule' imported by the module 'DynamicTestModule'The root cause of this issue seems to be webpack cannot find the lib module with its resolve rules.
I solved the issue by editing resolve rules in the webpack config file
node_modules/angular-cli/models/webpack-build-test.js:izoomi commentedon Feb 14, 2017
Same issue when running tests. @blingwang's solution fixes the problem.
chaosmonster commentedon Feb 27, 2017
what is the status on this issue?
avril-verhaeghen commentedon Apr 6, 2017
@chaosmonster this issue is fixed meanwhile. But if I remember correctly I had to add
schemas: [ CUSTOM_ELEMENTS_SCHEMA ]in the metadata for configuring my test module.
filipesilva commentedon May 22, 2017
Closing as outdated. If this still happens, please let me know.
AlexKhymenko commentedon Jan 22, 2018
@filipesilva Have the same issue again
@angular/cli: 1.6.5
@angular-devkit/build-optimizer: 0.0.41
@angular-devkit/core: 0.0.28
@angular-devkit/schematics: 0.0.51
@ngtools/json-schema: 1.1.0
@schematics/angular: 0.1.16
typescript: 2.5.3
webpack: 3.10.0
angular-automatic-lock-bot commentedon Sep 7, 2019
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.