DEV: removes memory profiling from qunit tests (#8120)

Most of the work on it has been done and it's un-necessary work for now.
This commit is contained in:
Joffrey JAFFEUX 2019-10-01 22:17:53 +02:00 committed by GitHub
parent a5af98a149
commit b4d42d1151
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 69 deletions

View File

@ -20,8 +20,6 @@ const CDP = require("chrome-remote-interface");
const QUNIT_RESULT = args[2];
const fs = require("fs");
const scripts = {};
if (QUNIT_RESULT) {
(async () => {
await fs.stat(QUNIT_RESULT, (err, stats) => {
@ -58,14 +56,9 @@ async function runAllTests() {
let chrome = await launchChrome();
let protocol = await CDP({ port: chrome.port });
const { Debugger, Inspector, Page, Runtime } = protocol;
const { Inspector, Page, Runtime } = protocol;
await Promise.all([
Debugger.enable(),
Inspector.enable(),
Page.enable(),
Runtime.enable()
]);
await Promise.all([Inspector.enable(), Page.enable(), Runtime.enable()]);
Inspector.targetCrashed(entry => {
console.log("Chrome target crashed:");
@ -96,10 +89,6 @@ async function runAllTests() {
console.log("navigate to " + args[0]);
Page.navigate({ url: args[0] });
Debugger.scriptParsed(g => {
scripts[g.scriptId] = g.url;
});
Page.loadEventFired(async () => {
await Runtime.evaluate({
expression: `(${qunit_script})()`
@ -110,8 +99,6 @@ async function runAllTests() {
var interval;
let runTests = async function() {
await protocol.Memory.startSampling();
if (Date.now() > start + timeout) {
console.error("Tests timed out");
protocol.close();
@ -124,60 +111,6 @@ async function runAllTests() {
});
if (numFails && numFails.result && numFails.result.type !== "undefined") {
const {
root: { nodeId: documentNodeId }
} = await protocol.DOM.getDocument();
const {
object: { objectId: remoteObjectId }
} = await protocol.DOM.resolveNode({
nodeId: documentNodeId
});
const result = await protocol.DOMDebugger.getEventListeners({
objectId: remoteObjectId
});
const onceReport = {};
const multiReport = {};
result.listeners.forEach(listener => {
const key = `${listener.type}${listener.scriptId}${
listener.lineNumber
}`;
if (onceReport[key]) {
multiReport[key] = multiReport[key] || onceReport[key];
multiReport[key].count += 1;
} else {
const script = scripts[listener.scriptId];
onceReport[key] = {
listener,
file: `${script || "unknown-file"}:${listener.lineNumber}`,
count: 1
};
}
});
if (Object.keys(multiReport).length) {
console.log(
`\n\nLeaked js event listeners\n----------------------------------------------\n`
);
Object.keys(multiReport).forEach(reportKey => {
const report = multiReport[reportKey];
console.log(
`${report.listener.type} - ${report.count} times : ${report.file}`
);
});
}
const { usedSize } = await protocol.Runtime.getHeapUsage();
console.log(`\n\nJS used heap\n----------------------------------------------\n${(
usedSize / 1073741824
).toFixed(3)}GB
`);
clearInterval(interval);
protocol.close();
chrome.kill();