diff --git a/packages/core/src/render3/jit/module.ts b/packages/core/src/render3/jit/module.ts index 1ac60246d3..b6f2e47588 100644 --- a/packages/core/src/render3/jit/module.ts +++ b/packages/core/src/render3/jit/module.ts @@ -171,7 +171,7 @@ function verifySemanticsOfNgModuleDef( ngModuleDef = getNgModuleDef(moduleType) !; if (!ngModuleDef) { throw new Error( - `Unexpected value '${moduleType.name}' imported by the module '${importingModule.name}'. Please add a @NgModule annotation.`); + `Unexpected value '${moduleType.name}' imported by the module '${importingModule.name}'. Please add an @NgModule annotation.`); } } else { ngModuleDef = getNgModuleDef(moduleType, true); @@ -186,7 +186,7 @@ function verifySemanticsOfNgModuleDef( const exports = maybeUnwrapFn(ngModuleDef.exports); declarations.forEach(verifyDeclarationsHaveDefinitions); const combinedDeclarations: Type[] = [ - ...declarations.map(resolveForwardRef), // + ...declarations.map(resolveForwardRef), ...flatten(imports.map(computeCombinedExports)).map(resolveForwardRef), ]; exports.forEach(verifyExportsAreDeclaredOrReExported); @@ -283,12 +283,12 @@ function verifySemanticsOfNgModuleDef( if (getComponentDef(type) || getDirectiveDef(type)) { throw new Error( - `Unexpected directive '${type.name}' imported by the module '${importingModule.name}'. Please add a @NgModule annotation.`); + `Unexpected directive '${type.name}' imported by the module '${importingModule.name}'. Please add an @NgModule annotation.`); } if (getPipeDef(type)) { throw new Error( - `Unexpected pipe '${type.name}' imported by the module '${importingModule.name}'. Please add a @NgModule annotation.`); + `Unexpected pipe '${type.name}' imported by the module '${importingModule.name}'. Please add an @NgModule annotation.`); } } } diff --git a/packages/core/test/acceptance/integration_spec.ts b/packages/core/test/acceptance/integration_spec.ts index af675d3f38..b4986714db 100644 --- a/packages/core/test/acceptance/integration_spec.ts +++ b/packages/core/test/acceptance/integration_spec.ts @@ -1428,7 +1428,8 @@ describe('acceptance integration tests', () => { .createComponent(SomeComponent); }) .toThrowError( - `Unexpected directive 'SomeComponent' imported by the module 'ModuleWithImportedComponent'. Please add a @NgModule annotation.`); + // The ViewEngine error has a typo, whereas the Ivy one fixes it. + /^Unexpected directive 'SomeComponent' imported by the module 'ModuleWithImportedComponent'\. Please add (a|an) @NgModule annotation\.$/); }); it('should throw with descriptive error message when a pipe is passed to imports', () => { @@ -1446,7 +1447,8 @@ describe('acceptance integration tests', () => { .createComponent(FixtureComponent); }) .toThrowError( - `Unexpected pipe 'SomePipe' imported by the module 'ModuleWithImportedPipe'. Please add a @NgModule annotation.`); + // The ViewEngine error has a typo, whereas the Ivy one fixes it. + /^Unexpected pipe 'SomePipe' imported by the module 'ModuleWithImportedPipe'\. Please add (a|an) @NgModule annotation\.$/); }); it('should throw with descriptive error message when a module is passed to declarations', () => { @@ -1501,7 +1503,8 @@ describe('acceptance integration tests', () => { .createComponent(FixtureComponent); }) .toThrowError( - `Unexpected value 'SomeModule' imported by the module 'ModuleWithImportedModule'. Please add a @NgModule annotation.`); + // The ViewEngine error has a typo, whereas the Ivy one fixes it. + /^Unexpected value 'SomeModule' imported by the module 'ModuleWithImportedModule'\. Please add (a|an) @NgModule annotation\.$/); }); });