mirror of
https://github.com/denoland/deno.git
synced 2024-12-24 08:09:08 -05:00
fix(inspector): ensure console methods provided by inspector are available (#16724)
This commit is contained in:
parent
5c7dc904fb
commit
1ec357faf3
5 changed files with 34 additions and 1 deletions
|
@ -4126,7 +4126,7 @@ mod tests {
|
|||
assert!(result.is_ok());
|
||||
let response: CompletionInfo =
|
||||
serde_json::from_value(result.unwrap()).unwrap();
|
||||
assert_eq!(response.entries.len(), 19);
|
||||
assert_eq!(response.entries.len(), 22);
|
||||
let result = request(
|
||||
&mut runtime,
|
||||
state_snapshot,
|
||||
|
|
6
cli/tests/testdata/inspector/inspector3.js
vendored
6
cli/tests/testdata/inspector/inspector3.js
vendored
|
@ -1,4 +1,10 @@
|
|||
// deno-lint-ignore-file
|
||||
|
||||
// check that console methods provided by V8 are available in the inspector
|
||||
console.timeStamp("foo");
|
||||
console.profile("foo");
|
||||
console.profileEnd("foo");
|
||||
|
||||
for (let i = 0; i < 128; i++) {
|
||||
console.log(i);
|
||||
debugger;
|
||||
|
|
|
@ -336,6 +336,9 @@ Deno.test(function consoleTestStringifyCircular() {
|
|||
groupEnd: [Function: groupEnd],
|
||||
clear: [Function: clear],
|
||||
trace: [Function: trace],
|
||||
profile: [Function: profile],
|
||||
profileEnd: [Function: profileEnd],
|
||||
timeStamp: [Function: timeStamp],
|
||||
indentLevel: 0,
|
||||
[Symbol(isConsoleInstance)]: true
|
||||
}`,
|
||||
|
@ -2103,3 +2106,9 @@ Deno.test(async function inspectAggregateError() {
|
|||
);
|
||||
}
|
||||
});
|
||||
|
||||
Deno.test(function inspectorMethods() {
|
||||
console.timeStamp("test");
|
||||
console.profile("test");
|
||||
console.profileEnd("test");
|
||||
});
|
||||
|
|
|
@ -2239,6 +2239,12 @@
|
|||
this.error(err.stack);
|
||||
};
|
||||
|
||||
// These methods are noops, but when the inspector is connected, they
|
||||
// call into V8.
|
||||
profile = (_label) => {};
|
||||
profileEnd = (_label) => {};
|
||||
timeStamp = (_label) => {};
|
||||
|
||||
static [SymbolHasInstance](instance) {
|
||||
return instance[isConsoleInstance];
|
||||
}
|
||||
|
@ -2332,6 +2338,9 @@
|
|||
consoleFromV8[key],
|
||||
consoleFromDeno[key],
|
||||
);
|
||||
} else {
|
||||
// Add additional console APIs from the inspector
|
||||
consoleFromDeno[key] = consoleFromV8[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
9
ext/console/lib.deno_console.d.ts
vendored
9
ext/console/lib.deno_console.d.ts
vendored
|
@ -26,4 +26,13 @@ declare interface Console {
|
|||
timeLog(label?: string, ...data: any[]): void;
|
||||
trace(...data: any[]): void;
|
||||
warn(...data: any[]): void;
|
||||
|
||||
/** This method is a noop, unless used in inspector */
|
||||
timeStamp(label?: string): void;
|
||||
|
||||
/** This method is a noop, unless used in inspector */
|
||||
profile(label?: string): void;
|
||||
|
||||
/** This method is a noop, unless used in inspector */
|
||||
profileEnd(label?: string): void;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue