fix(ngcc): log Angular error codes correctly (#34014)

Replaces the "TS-99" sequence with just "NG", so that error codes are
logged correctly.

PR Close #34014
This commit is contained in:
JoostK
2019-11-23 19:17:16 +01:00
committed by Andrew Kushnir
parent 599dcd0d85
commit 3cd43c1173
3 changed files with 33 additions and 16 deletions

View File

@ -116,13 +116,13 @@ runInEachFileSystem(() => {
compileIntoFlatEs5Package('test-package', {
'/index.ts': `
import {Directive, Input, NgModule} from '@angular/core';
@Directive({selector: '[foo]'})
export class FooDirective {
@Input() get bar() { return 'bar'; }
set bar(value: string) {}
}
@NgModule({
declarations: [FooDirective],
})
@ -149,14 +149,14 @@ runInEachFileSystem(() => {
compileIntoFlatEs5Package('test-package', {
'/index.ts': `
import {Directive, Input, NgModule} from '@angular/core';
@Directive({
selector: '[foo]',
host: {bar: ''},
})
export class FooDirective {
}
@NgModule({
declarations: [FooDirective],
})
@ -210,7 +210,7 @@ runInEachFileSystem(() => {
compileIntoFlatEs5Package('test-package', {
'/index.ts': `
import {Injectable, Pipe, PipeTransform} from '@angular/core';
@Injectable()
@Pipe({
name: 'myTestPipe'
@ -759,13 +759,20 @@ runInEachFileSystem(() => {
`,
},
]);
expect(() => mainNgcc({
basePath: '/node_modules',
targetEntryPointPath: 'fatal-error',
propertiesToConsider: ['es2015']
}))
.toThrowError(
/^Failed to compile entry-point fatal-error due to compilation errors:\nnode_modules\/fatal-error\/index\.js\(5,17\): error TS-992001: component is missing a template\r?\n$/);
try {
mainNgcc({
basePath: '/node_modules',
targetEntryPointPath: 'fatal-error',
propertiesToConsider: ['es2015']
});
fail('should have thrown');
} catch (e) {
expect(e.message).toContain(
'Failed to compile entry-point fatal-error due to compilation errors:');
expect(e.message).toContain('NG2001');
expect(e.message).toContain('component is missing a template');
}
});
});