From 4cbf8ccf0501dd750cc66d03935ed525c878476f Mon Sep 17 00:00:00 2001 From: Bowen Ni Date: Wed, 23 Nov 2016 13:49:57 -0800 Subject: [PATCH] Keep `console.log` that are not called during compilation. --- .../benchpress/test/firefox_extension/spec.ts | 5 ++++- modules/@angular/examples/_common/e2e_util.ts | 2 ++ modules/benchmarks/src/util.ts | 3 +++ modules/e2e_util/e2e_util.ts | 3 ++- tools/tsc-watch/index.ts | 4 ++++ tools/tsc-watch/tsc_watch.ts | 11 ++++++++--- 6 files changed, 23 insertions(+), 5 deletions(-) diff --git a/modules/@angular/benchpress/test/firefox_extension/spec.ts b/modules/@angular/benchpress/test/firefox_extension/spec.ts index 15033c0855..9b0d9421f9 100644 --- a/modules/@angular/benchpress/test/firefox_extension/spec.ts +++ b/modules/@angular/benchpress/test/firefox_extension/spec.ts @@ -6,6 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ +/* tslint:disable:no-console */ import {browser} from 'protractor'; const assertEventsContainsName = function(events: any[], eventName: string) { @@ -27,7 +28,9 @@ describe('firefox extension', function() { browser.driver.get(TEST_URL); - browser.executeScript('window.startProfiler()'); + browser.executeScript('window.startProfiler()').then(function() { + console.log('started measuring perf'); + }); browser.executeAsyncScript('setTimeout(arguments[0], 1000);'); browser.executeScript('window.forceGC()'); diff --git a/modules/@angular/examples/_common/e2e_util.ts b/modules/@angular/examples/_common/e2e_util.ts index 6d0deb77b2..4ca6732c1e 100644 --- a/modules/@angular/examples/_common/e2e_util.ts +++ b/modules/@angular/examples/_common/e2e_util.ts @@ -5,6 +5,7 @@ * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ +/* tslint:disable:no-console */ import * as webdriver from 'selenium-webdriver'; declare var browser: any; declare var expect: any; @@ -15,6 +16,7 @@ export function verifyNoBrowserErrors() { const errors: any[] = []; browserLog.filter(logEntry => { const msg = logEntry.message; + console.log('>> ' + msg); if (logEntry.level.value >= webdriver.logging.Level.INFO.value) { errors.push(msg); } diff --git a/modules/benchmarks/src/util.ts b/modules/benchmarks/src/util.ts index 6edcbf5850..15209bb3d9 100644 --- a/modules/benchmarks/src/util.ts +++ b/modules/benchmarks/src/util.ts @@ -6,6 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ +/* tslint:disable:no-console */ urlParamsToForm(); export function getIntParameter(name: string) { @@ -51,6 +52,7 @@ export function profile(create: () => void, destroy: () => void, name: string) { destroy(); } window.console.profileEnd(); + window.console.log(`Iterations: ${count}; time: ${duration / count} ms / iteration`); window.console.profile(name + ' w/o GC'); duration = 0; @@ -62,6 +64,7 @@ export function profile(create: () => void, destroy: () => void, name: string) { destroy(); } window.console.profileEnd(); + window.console.log(`Iterations: ${count}; time: ${duration / count} ms / iteration`); }; } diff --git a/modules/e2e_util/e2e_util.ts b/modules/e2e_util/e2e_util.ts index 344190dca7..6a5023e114 100644 --- a/modules/e2e_util/e2e_util.ts +++ b/modules/e2e_util/e2e_util.ts @@ -6,6 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ +/* tslint:disable:no-console */ import {browser} from 'protractor'; const yargs = require('yargs'); @@ -59,7 +60,7 @@ export function verifyNoBrowserErrors() { browser.manage().logs().get('browser').then(function(browserLog: any) { const filteredLog = browserLog.filter(function(logEntry: any) { if (logEntry.level.value >= webdriver.logging.Level.INFO.value) { - console.error('>> ' + logEntry.message); + console.log('>> ' + logEntry.message); } return logEntry.level.value > webdriver.logging.Level.WARNING.value; }); diff --git a/tools/tsc-watch/index.ts b/tools/tsc-watch/index.ts index 67cf8c604f..856f4825ec 100644 --- a/tools/tsc-watch/index.ts +++ b/tools/tsc-watch/index.ts @@ -6,6 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ +/* tslint:disable:no-console */ import {spawn} from 'child_process'; import {existsSync, mkdirSync, writeFileSync} from 'fs'; @@ -21,9 +22,11 @@ function processOutputEmitterCodeGen(): Promise { return new Promise((resolve, reject) => { const outDir = 'dist/all/@angular/compiler/test/'; const promises: Promise[] = []; + console.log('Processing codegen...'); OFFLINE_COMPILE.forEach((file: string) => { const codegen = require('../../all/@angular/compiler/test/' + file + '.js'); if (codegen.emit) { + console.log(` ${file} has changed, regenerating...`); promises.push(Promise.resolve(codegen.emit()).then((code) => { writeFileSync(outDir + file + '.ts', code); })); @@ -34,6 +37,7 @@ function processOutputEmitterCodeGen(): Promise { .then(() => { const args = ['--project', 'tools/cjs-jasmine/tsconfig-output_emitter_codegen.json']; + console.log(' compiling changes: tsc ' + args.join(' ')); const tsc = spawn(TSC, args, {stdio: 'pipe'}); tsc.stdout.on('data', (data: any) => process.stdout.write(data)); tsc.stderr.on('data', (data: any) => process.stderr.write(data)); diff --git a/tools/tsc-watch/tsc_watch.ts b/tools/tsc-watch/tsc_watch.ts index 02e2fe2900..541549ed5b 100644 --- a/tools/tsc-watch/tsc_watch.ts +++ b/tools/tsc-watch/tsc_watch.ts @@ -6,6 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ +/* tslint:disable:no-console */ import {spawn} from 'child_process'; import {platform} from 'os'; import {normalize} from 'path'; @@ -37,6 +38,7 @@ export class TscWatch { start: string, complete: string, onStartCmds?: Array, onChangeCmds?: Array }) { + console.log('Watching:', tsconfig, 'in', process.cwd()); this.tsconfig = tsconfig; this.start = start; this.error = error; @@ -66,12 +68,14 @@ export class TscWatch { const args = argsOrCmd as Array; return new Promise((resolve, reject) => { const [cmd, ...options] = args; + console.log('=====>', cmd, options.join(' ')); const childProcess = spawn(cmd, options, {stdio: 'pipe'}); childProcess.stdout.on('data', stdOut); childProcess.stderr.on('data', stdErr); const onExit = () => childProcess.kill(); childProcess.on('close', (code: number) => { process.removeListener('exit', onExit); + console.log('EXIT:', code, '<=====', args.join(' ')); code ? reject(code) : resolve(code); }); process.on('exit', onExit); @@ -95,6 +99,7 @@ export class TscWatch { consumeLine(buffer: Buffer, isStdError: boolean) { const line = '' + buffer; if (contains(line, this.start)) { + console.log('=============================================================================='); stdOut(buffer, isStdError); this.state = State.waiting; } else if (contains(line, this.error)) { @@ -102,15 +107,15 @@ export class TscWatch { this.state = State.error; } else if (contains(line, this.complete)) { stdOut(buffer, isStdError); + console.log('------------------------------------------------------------------------------'); if (this.state == State.error) { - console.error('Errors found.... (response not triggered)'); + console.log('Errors found.... (response not triggered)'); if (this.runOnce) process.exit(1); this.state = State.idle; } else { if (this.triggered) { this.triggered.then( - () => this.triggerCmds(), - (e) => console.error('Error while running commands....', e)); + () => this.triggerCmds(), (e) => console.log('Error while running commands....', e)); } else { this.triggerCmds(); }