mirror of
https://github.com/denoland/deno.git
synced 2025-01-06 22:35:51 -05:00
fix(inspector): ensure console methods provided by inspector are available (#16724)
This commit is contained in:
parent
82a6b1c5dc
commit
cdb180fd66
5 changed files with 34 additions and 1 deletions
|
@ -4126,7 +4126,7 @@ mod tests {
|
||||||
assert!(result.is_ok());
|
assert!(result.is_ok());
|
||||||
let response: CompletionInfo =
|
let response: CompletionInfo =
|
||||||
serde_json::from_value(result.unwrap()).unwrap();
|
serde_json::from_value(result.unwrap()).unwrap();
|
||||||
assert_eq!(response.entries.len(), 19);
|
assert_eq!(response.entries.len(), 22);
|
||||||
let result = request(
|
let result = request(
|
||||||
&mut runtime,
|
&mut runtime,
|
||||||
state_snapshot,
|
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
|
// 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++) {
|
for (let i = 0; i < 128; i++) {
|
||||||
console.log(i);
|
console.log(i);
|
||||||
debugger;
|
debugger;
|
||||||
|
|
|
@ -336,6 +336,9 @@ Deno.test(function consoleTestStringifyCircular() {
|
||||||
groupEnd: [Function: groupEnd],
|
groupEnd: [Function: groupEnd],
|
||||||
clear: [Function: clear],
|
clear: [Function: clear],
|
||||||
trace: [Function: trace],
|
trace: [Function: trace],
|
||||||
|
profile: [Function: profile],
|
||||||
|
profileEnd: [Function: profileEnd],
|
||||||
|
timeStamp: [Function: timeStamp],
|
||||||
indentLevel: 0,
|
indentLevel: 0,
|
||||||
[Symbol(isConsoleInstance)]: true
|
[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);
|
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) {
|
static [SymbolHasInstance](instance) {
|
||||||
return instance[isConsoleInstance];
|
return instance[isConsoleInstance];
|
||||||
}
|
}
|
||||||
|
@ -2332,6 +2338,9 @@
|
||||||
consoleFromV8[key],
|
consoleFromV8[key],
|
||||||
consoleFromDeno[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;
|
timeLog(label?: string, ...data: any[]): void;
|
||||||
trace(...data: any[]): void;
|
trace(...data: any[]): void;
|
||||||
warn(...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