[node] add/fix console methods for 9.x

This commit is contained in:
Jeff Kenney
2018-12-14 22:53:19 -08:00
parent bda5344c41
commit 9f88ee6e80
2 changed files with 76 additions and 1 deletions
+22 -1
View File
@@ -109,6 +109,13 @@ interface Console {
warn(message?: any, ...optionalParams: any[]): void;
// --- Inspector mode only ---
/**
* This method does not display anything unless used in the inspector.
* The console.markTimeline() method is the deprecated form of console.timeStamp().
*
* @deprecated Use console.timeStamp() instead.
*/
markTimeline(label?: string): void;
/**
* This method does not display anything unless used in the inspector.
* Starts a JavaScript CPU profile with an optional label.
@@ -118,7 +125,7 @@ interface Console {
* This method does not display anything unless used in the inspector.
* Stops the current JavaScript CPU profiling session if one has been started and prints the report to the Profiles panel of the inspector.
*/
profileEnd(): void;
profileEnd(label?: string): void;
/**
* This method does not display anything unless used in the inspector.
* Prints to `stdout` the array `array` formatted as a table.
@@ -129,6 +136,20 @@ interface Console {
* Adds an event with the label `label` to the Timeline panel of the inspector.
*/
timeStamp(label?: string): void;
/**
* This method does not display anything unless used in the inspector.
* The console.timeline() method is the deprecated form of console.time().
*
* @deprecated Use console.time() instead.
*/
timeline(label?: string): void;
/**
* This method does not display anything unless used in the inspector.
* The console.timelineEnd() method is the deprecated form of console.timeEnd().
*
* @deprecated Use console.timeEnd() instead.
*/
timelineEnd(label?: string): void;
}
interface Error {
+54
View File
@@ -2735,6 +2735,60 @@ namespace console_tests {
var writeStream = fs.createWriteStream('./index.d.ts');
var consoleInstance = new console.Console(writeStream);
}
{
console.assert('value');
console.assert('value', 'message');
console.assert('value', 'message', 'foo', 'bar');
console.clear();
console.count();
console.count('label');
console.countReset();
console.countReset('label');
console.debug();
console.debug('message');
console.debug('message', 'foo', 'bar');
console.dir('obj');
console.dir('obj', { depth: 1 });
console.error();
console.error('message');
console.error('message', 'foo', 'bar');
console.group();
console.group('label');
console.group('label1', 'label2');
console.groupCollapsed();
console.groupEnd();
console.info();
console.info('message');
console.info('message', 'foo', 'bar');
console.log();
console.log('message');
console.log('message', 'foo', 'bar');
console.time('label');
console.timeEnd('label');
console.trace();
console.trace('message');
console.trace('message', 'foo', 'bar');
console.warn();
console.warn('message');
console.warn('message', 'foo', 'bar');
// --- Inspector mode only ---
console.markTimeline();
console.markTimeline('label');
console.profile();
console.profile('label');
console.profileEnd();
console.profileEnd('label');
console.table({ foo: 'bar' });
console.table([{ foo: 'bar' }]);
console.table([{ foo: 'bar' }], ['foo']);
console.timeStamp();
console.timeStamp('label');
console.timeline();
console.timeline('label');
console.timelineEnd();
console.timelineEnd('label');
}
}
///////////////////////////////////////////////////