fix(zone.js): add issue numbers of @types/jasmine to the test cases (#34625)

Some cases will still need to use `spy as any` cast, because `@types/jasmine` have some issues,
1. The issue jasmine doesn't handle optional method properties, https://github.com/DefinitelyTyped/DefinitelyTyped/issues/43486
2. The issue jasmine doesn't handle overload method correctly, https://github.com/DefinitelyTyped/DefinitelyTyped/issues/42455

PR Close #34625
This commit is contained in:
JiaLiPassion
2020-03-31 00:22:25 +09:00
committed by Kara Erickson
parent b28a5f6eef
commit 421b6a97d6
22 changed files with 5993 additions and 5745 deletions

View File

@ -41,7 +41,9 @@ describe('ngc transformer command-line', () => {
basePath = support.basePath;
outDir = path.join(basePath, 'built');
process.chdir(basePath);
write = (fileName: string, content: string) => { support.write(fileName, content); };
write = (fileName: string, content: string) => {
support.write(fileName, content);
};
write('tsconfig-base.json', `{
"compilerOptions": {
@ -96,8 +98,9 @@ describe('ngc transformer command-line', () => {
});
describe('errors', () => {
beforeEach(() => { errorSpy.and.stub(); });
beforeEach(() => {
errorSpy.and.stub();
});
it('should not print the stack trace if user input file does not exist', () => {
writeConfig(`{
@ -231,7 +234,6 @@ describe('ngc transformer command-line', () => {
});
describe('compile ngfactory files', () => {
it('should compile ngfactory files that are not referenced by root files', () => {
writeConfig(`{
"extends": "./tsconfig-base.json",
@ -1122,7 +1124,6 @@ describe('ngc transformer command-line', () => {
});
describe('with external symbol re-exports enabled', () => {
it('should be able to compile multiple libraries with summaries', () => {
// Note: we need to emit the generated code for the libraries
// into the node_modules, as that is the only way that we
@ -1560,11 +1561,13 @@ describe('ngc transformer command-line', () => {
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
const timerToken = 100;
// TODO: @JiaLiPassion, need to wait @types/jasmine to handle optional method case
// https://github.com/DefinitelyTyped/DefinitelyTyped/issues/43486
spyOn(ts.sys as any, 'setTimeout').and.callFake((callback: () => void) => {
timer = callback;
return timerToken;
});
// TODO: @JiaLiPassion, need to wait @types/jasmine to handle optional method case
// https://github.com/DefinitelyTyped/DefinitelyTyped/issues/43486
spyOn(ts.sys as any, 'clearTimeout').and.callFake((token: number) => {
if (token == timerToken) {
timer = undefined;
@ -1617,7 +1620,9 @@ describe('ngc transformer command-line', () => {
`);
});
afterEach(() => { jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout; });
afterEach(() => {
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
});
function writeAppConfig(location: string) {
writeConfig(`{
@ -1672,11 +1677,13 @@ describe('ngc transformer command-line', () => {
`);
}));
it('should recompile when the html file changes',
expectRecompile(() => { write('greet.html', '<p> Hello {{name}} again!</p>'); }));
it('should recompile when the html file changes', expectRecompile(() => {
write('greet.html', '<p> Hello {{name}} again!</p>');
}));
it('should recompile when the css file changes',
expectRecompile(() => { write('greet.css', `p.greeting { color: blue }`); }));
it('should recompile when the css file changes', expectRecompile(() => {
write('greet.css', `p.greeting { color: blue }`);
}));
});
describe('regressions', () => {
@ -2041,8 +2048,8 @@ describe('ngc transformer command-line', () => {
expect(exitCode).toBe(1, 'Compile was expected to fail');
const srcPathWithSep = `lib/`;
expect(messages[0])
.toEqual(
`${srcPathWithSep}test.component.ts(6,21): Error during template compile of 'TestComponent'
.toEqual(`${
srcPathWithSep}test.component.ts(6,21): Error during template compile of 'TestComponent'
Tagged template expressions are not supported in metadata in 't1'
't1' references 't2' at ${srcPathWithSep}indirect1.ts(3,27)
't2' contains the error at ${srcPathWithSep}indirect2.ts(4,27).
@ -2051,7 +2058,6 @@ describe('ngc transformer command-line', () => {
});
describe('tree shakeable services', () => {
function compileService(source: string): string {
write('service.ts', source);