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
*/
/* 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()');

View File

@ -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);
}

View File

@ -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`);
};
}

View File

@ -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;
});

View File

@ -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<number> {
return new Promise((resolve, reject) => {
const outDir = 'dist/all/@angular/compiler/test/';
const promises: Promise<any>[] = [];
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<number> {
.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));

View File

@ -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<string[]|Command>, onChangeCmds?: Array<string[]|Command>
}) {
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<string>;
return <any>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();
}