I have a medium sized Angular application and for some reasons some of my protractor tests are timing out when run against my live production environment.
I am fairly sur
JeB did a great job suggesting his way (some solution is better than nothing). In fact, there is way to get list of pending tasks without patching zone.js file.
I get this idea while looking at angular sources: https://github.com/angular/angular/blob/master/packages/core/src/zone/ng_zone.ts#L134
Here is how to:
node_modules/zone.js/dist/task-tracking.js file after zone.jsNgZone instance and use it like import * as _ from "lodash";
...
const ngZone = moduleInstance.injector.get(NgZone);
setInterval(() => {
var taskTrackingZone = (ngZone)._inner.getZoneWith("TaskTrackingZone");
if (!taskTrackingZone) {
throw new Error("'TaskTrackingZone' zone not found! Have you loaded 'node_modules/zone.js/dist/task-tracking.js'?");
}
var tasks: any[] = taskTrackingZone._properties.TaskTrackingZone.getTasksFor("macroTask");
tasks = _.clone(tasks);
if (_.size(tasks) > 0) {
console.log("ZONE pending tasks=", tasks);
}
}, 1000);
Example is placed here: https://stackblitz.com/edit/zonejs-pending-tasks.
How it works: