Keep `console.log` that are not called during compilation.

This commit is contained in:
Bowen Ni 2016-11-23 13:49:57 -08:00 committed by vsavkin
parent a6c4490fce
commit 4cbf8ccf05
6 changed files with 23 additions and 5 deletions

View File

@ -6,6 +6,7 @@
* found in the LICENSE file at https://angular.io/license * found in the LICENSE file at https://angular.io/license
*/ */
/* tslint:disable:no-console */
import {browser} from 'protractor'; import {browser} from 'protractor';
const assertEventsContainsName = function(events: any[], eventName: string) { const assertEventsContainsName = function(events: any[], eventName: string) {
@ -27,7 +28,9 @@ describe('firefox extension', function() {
browser.driver.get(TEST_URL); 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.executeAsyncScript('setTimeout(arguments[0], 1000);');
browser.executeScript('window.forceGC()'); browser.executeScript('window.forceGC()');

View File

@ -5,6 +5,7 @@
* Use of this source code is governed by an MIT-style license that can be * 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 * found in the LICENSE file at https://angular.io/license
*/ */
/* tslint:disable:no-console */
import * as webdriver from 'selenium-webdriver'; import * as webdriver from 'selenium-webdriver';
declare var browser: any; declare var browser: any;
declare var expect: any; declare var expect: any;
@ -15,6 +16,7 @@ export function verifyNoBrowserErrors() {
const errors: any[] = []; const errors: any[] = [];
browserLog.filter(logEntry => { browserLog.filter(logEntry => {
const msg = logEntry.message; const msg = logEntry.message;
console.log('>> ' + msg);
if (logEntry.level.value >= webdriver.logging.Level.INFO.value) { if (logEntry.level.value >= webdriver.logging.Level.INFO.value) {
errors.push(msg); errors.push(msg);
} }

View File

@ -6,6 +6,7 @@
* found in the LICENSE file at https://angular.io/license * found in the LICENSE file at https://angular.io/license
*/ */
/* tslint:disable:no-console */
urlParamsToForm(); urlParamsToForm();
export function getIntParameter(name: string) { export function getIntParameter(name: string) {
@ -51,6 +52,7 @@ export function profile(create: () => void, destroy: () => void, name: string) {
destroy(); destroy();
} }
window.console.profileEnd(); window.console.profileEnd();
window.console.log(`Iterations: ${count}; time: ${duration / count} ms / iteration`);
window.console.profile(name + ' w/o GC'); window.console.profile(name + ' w/o GC');
duration = 0; duration = 0;
@ -62,6 +64,7 @@ export function profile(create: () => void, destroy: () => void, name: string) {
destroy(); destroy();
} }
window.console.profileEnd(); window.console.profileEnd();
window.console.log(`Iterations: ${count}; time: ${duration / count} ms / iteration`);
}; };
} }

View File

@ -6,6 +6,7 @@
* found in the LICENSE file at https://angular.io/license * found in the LICENSE file at https://angular.io/license
*/ */
/* tslint:disable:no-console */
import {browser} from 'protractor'; import {browser} from 'protractor';
const yargs = require('yargs'); const yargs = require('yargs');
@ -59,7 +60,7 @@ export function verifyNoBrowserErrors() {
browser.manage().logs().get('browser').then(function(browserLog: any) { browser.manage().logs().get('browser').then(function(browserLog: any) {
const filteredLog = browserLog.filter(function(logEntry: any) { const filteredLog = browserLog.filter(function(logEntry: any) {
if (logEntry.level.value >= webdriver.logging.Level.INFO.value) { 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; return logEntry.level.value > webdriver.logging.Level.WARNING.value;
}); });

View File

@ -6,6 +6,7 @@
* found in the LICENSE file at https://angular.io/license * found in the LICENSE file at https://angular.io/license
*/ */
/* tslint:disable:no-console */
import {spawn} from 'child_process'; import {spawn} from 'child_process';
import {existsSync, mkdirSync, writeFileSync} from 'fs'; import {existsSync, mkdirSync, writeFileSync} from 'fs';
@ -21,9 +22,11 @@ function processOutputEmitterCodeGen(): Promise<number> {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const outDir = 'dist/all/@angular/compiler/test/'; const outDir = 'dist/all/@angular/compiler/test/';
const promises: Promise<any>[] = []; const promises: Promise<any>[] = [];
console.log('Processing codegen...');
OFFLINE_COMPILE.forEach((file: string) => { OFFLINE_COMPILE.forEach((file: string) => {
const codegen = require('../../all/@angular/compiler/test/' + file + '.js'); const codegen = require('../../all/@angular/compiler/test/' + file + '.js');
if (codegen.emit) { if (codegen.emit) {
console.log(` ${file} has changed, regenerating...`);
promises.push(Promise.resolve(codegen.emit()).then((code) => { promises.push(Promise.resolve(codegen.emit()).then((code) => {
writeFileSync(outDir + file + '.ts', code); writeFileSync(outDir + file + '.ts', code);
})); }));
@ -34,6 +37,7 @@ function processOutputEmitterCodeGen(): Promise<number> {
.then(() => { .then(() => {
const args = const args =
['--project', 'tools/cjs-jasmine/tsconfig-output_emitter_codegen.json']; ['--project', 'tools/cjs-jasmine/tsconfig-output_emitter_codegen.json'];
console.log(' compiling changes: tsc ' + args.join(' '));
const tsc = spawn(TSC, args, {stdio: 'pipe'}); const tsc = spawn(TSC, args, {stdio: 'pipe'});
tsc.stdout.on('data', (data: any) => process.stdout.write(data)); tsc.stdout.on('data', (data: any) => process.stdout.write(data));
tsc.stderr.on('data', (data: any) => process.stderr.write(data)); tsc.stderr.on('data', (data: any) => process.stderr.write(data));

View File

@ -6,6 +6,7 @@
* found in the LICENSE file at https://angular.io/license * found in the LICENSE file at https://angular.io/license
*/ */
/* tslint:disable:no-console */
import {spawn} from 'child_process'; import {spawn} from 'child_process';
import {platform} from 'os'; import {platform} from 'os';
import {normalize} from 'path'; import {normalize} from 'path';
@ -37,6 +38,7 @@ export class TscWatch {
start: string, start: string,
complete: string, onStartCmds?: Array<string[]|Command>, onChangeCmds?: Array<string[]|Command> complete: string, onStartCmds?: Array<string[]|Command>, onChangeCmds?: Array<string[]|Command>
}) { }) {
console.log('Watching:', tsconfig, 'in', process.cwd());
this.tsconfig = tsconfig; this.tsconfig = tsconfig;
this.start = start; this.start = start;
this.error = error; this.error = error;
@ -66,12 +68,14 @@ export class TscWatch {
const args = argsOrCmd as Array<string>; const args = argsOrCmd as Array<string>;
return <any>new Promise((resolve, reject) => { return <any>new Promise((resolve, reject) => {
const [cmd, ...options] = args; const [cmd, ...options] = args;
console.log('=====>', cmd, options.join(' '));
const childProcess = spawn(cmd, options, {stdio: 'pipe'}); const childProcess = spawn(cmd, options, {stdio: 'pipe'});
childProcess.stdout.on('data', stdOut); childProcess.stdout.on('data', stdOut);
childProcess.stderr.on('data', stdErr); childProcess.stderr.on('data', stdErr);
const onExit = () => childProcess.kill(); const onExit = () => childProcess.kill();
childProcess.on('close', (code: number) => { childProcess.on('close', (code: number) => {
process.removeListener('exit', onExit); process.removeListener('exit', onExit);
console.log('EXIT:', code, '<=====', args.join(' '));
code ? reject(code) : resolve(code); code ? reject(code) : resolve(code);
}); });
process.on('exit', onExit); process.on('exit', onExit);
@ -95,6 +99,7 @@ export class TscWatch {
consumeLine(buffer: Buffer, isStdError: boolean) { consumeLine(buffer: Buffer, isStdError: boolean) {
const line = '' + buffer; const line = '' + buffer;
if (contains(line, this.start)) { if (contains(line, this.start)) {
console.log('==============================================================================');
stdOut(buffer, isStdError); stdOut(buffer, isStdError);
this.state = State.waiting; this.state = State.waiting;
} else if (contains(line, this.error)) { } else if (contains(line, this.error)) {
@ -102,15 +107,15 @@ export class TscWatch {
this.state = State.error; this.state = State.error;
} else if (contains(line, this.complete)) { } else if (contains(line, this.complete)) {
stdOut(buffer, isStdError); stdOut(buffer, isStdError);
console.log('------------------------------------------------------------------------------');
if (this.state == State.error) { 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); if (this.runOnce) process.exit(1);
this.state = State.idle; this.state = State.idle;
} else { } else {
if (this.triggered) { if (this.triggered) {
this.triggered.then( this.triggered.then(
() => this.triggerCmds(), () => this.triggerCmds(), (e) => console.log('Error while running commands....', e));
(e) => console.error('Error while running commands....', e));
} else { } else {
this.triggerCmds(); this.triggerCmds();
} }