diff --git a/packages/compiler/test/aot/compiler_spec.ts b/packages/compiler/test/aot/compiler_spec.ts index a00e2c9ea2..bd2276f61e 100644 --- a/packages/compiler/test/aot/compiler_spec.ts +++ b/packages/compiler/test/aot/compiler_spec.ts @@ -8,12 +8,12 @@ import {GeneratedFile, toTypeScript} from '@angular/compiler'; import {NodeFlags} from '@angular/core/src/view/index'; -import {MetadataBundler, MetadataCollector, ModuleMetadata, privateEntriesToIndex} from '@angular/tsc-wrapped'; +import {MetadataBundler, privateEntriesToIndex} from '@angular/tsc-wrapped'; import * as ts from 'typescript'; import {extractSourceMap, originalPositionFor} from '../output/source_map_util'; -import {EmittingCompilerHost, MockData, MockDirectory, MockMetadataBundlerHost, arrayToMockDir, arrayToMockMap, compile, expectNoDiagnostics, settings, setup, toMockFileArray} from './test_util'; +import {EmittingCompilerHost, MockDirectory, MockMetadataBundlerHost, arrayToMockDir, compile, expectNoDiagnostics, settings, setup, toMockFileArray} from './test_util'; describe('compiler (unbundled Angular)', () => { let angularFiles = setup(); @@ -208,7 +208,7 @@ describe('compiler (unbundled Angular)', () => { }); - it('should be able to supress a null access', () => { + it('should be able to suppress a null access', () => { const FILES: MockDirectory = { app: { 'app.ts': ` @@ -266,6 +266,24 @@ describe('compiler (unbundled Angular)', () => { }); }); + it('should report when a component is declared in any module', () => { + const FILES: MockDirectory = { + app: { + 'app.ts': ` + import {Component, NgModule} from '@angular/core'; + + @Component({selector: 'my-comp', template: ''}) + export class MyComp {} + + @NgModule({}) + export class MyModule {} + ` + } + }; + expect(() => compile([FILES, angularFiles])) + .toThrowError(/Cannot determine the module for class MyComp/); + }); + it('should add the preamble to generated files', () => { const FILES: MockDirectory = { app: { @@ -746,7 +764,6 @@ const LIBRARY: MockDirectory = { } }; -const LIBRARY_USING_APP_MODULE = ['/lib-user/app/app.module.ts']; const LIBRARY_USING_APP: MockDirectory = { 'lib-user': { app: {