Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit 44c46fa

Browse files
committed
chore: Release v0.6.18
1 parent baf9cdb commit 44c46fa

18 files changed

+2850
-7669
lines changed

dist/async-test.js

+68-118
Original file line numberDiff line numberDiff line change
@@ -1,118 +1,68 @@
1-
/******/ (function(modules) { // webpackBootstrap
2-
/******/ // The module cache
3-
/******/ var installedModules = {};
4-
5-
/******/ // The require function
6-
/******/ function __webpack_require__(moduleId) {
7-
8-
/******/ // Check if module is in cache
9-
/******/ if(installedModules[moduleId])
10-
/******/ return installedModules[moduleId].exports;
11-
12-
/******/ // Create a new module (and put it into the cache)
13-
/******/ var module = installedModules[moduleId] = {
14-
/******/ exports: {},
15-
/******/ id: moduleId,
16-
/******/ loaded: false
17-
/******/ };
18-
19-
/******/ // Execute the module function
20-
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
21-
22-
/******/ // Flag the module as loaded
23-
/******/ module.loaded = true;
24-
25-
/******/ // Return the exports of the module
26-
/******/ return module.exports;
27-
/******/ }
28-
29-
30-
/******/ // expose the modules object (__webpack_modules__)
31-
/******/ __webpack_require__.m = modules;
32-
33-
/******/ // expose the module cache
34-
/******/ __webpack_require__.c = installedModules;
35-
36-
/******/ // __webpack_public_path__
37-
/******/ __webpack_require__.p = "";
38-
39-
/******/ // Load entry module and return exports
40-
/******/ return __webpack_require__(0);
41-
/******/ })
42-
/************************************************************************/
43-
/******/ ([
44-
/* 0 */
45-
/***/ function(module, exports) {
46-
47-
(function () {
48-
var AsyncTestZoneSpec = (function () {
49-
function AsyncTestZoneSpec(finishCallback, failCallback, namePrefix) {
50-
this._pendingMicroTasks = false;
51-
this._pendingMacroTasks = false;
52-
this._alreadyErrored = false;
53-
this.runZone = Zone.current;
54-
this._finishCallback = finishCallback;
55-
this._failCallback = failCallback;
56-
this.name = 'asyncTestZone for ' + namePrefix;
57-
}
58-
AsyncTestZoneSpec.prototype._finishCallbackIfDone = function () {
59-
var _this = this;
60-
if (!(this._pendingMicroTasks || this._pendingMacroTasks)) {
61-
// We do this because we would like to catch unhandled rejected promises.
62-
this.runZone.run(function () {
63-
setTimeout(function () {
64-
if (!_this._alreadyErrored && !(_this._pendingMicroTasks || _this._pendingMacroTasks)) {
65-
_this._finishCallback();
66-
}
67-
}, 0);
68-
});
69-
}
70-
};
71-
// Note - we need to use onInvoke at the moment to call finish when a test is
72-
// fully synchronous. TODO(juliemr): remove this when the logic for
73-
// onHasTask changes and it calls whenever the task queues are dirty.
74-
AsyncTestZoneSpec.prototype.onInvoke = function (parentZoneDelegate, currentZone, targetZone, delegate, applyThis, applyArgs, source) {
75-
try {
76-
return parentZoneDelegate.invoke(targetZone, delegate, applyThis, applyArgs, source);
77-
}
78-
finally {
79-
this._finishCallbackIfDone();
80-
}
81-
};
82-
AsyncTestZoneSpec.prototype.onHandleError = function (parentZoneDelegate, currentZone, targetZone, error) {
83-
// Let the parent try to handle the error.
84-
var result = parentZoneDelegate.handleError(targetZone, error);
85-
if (result) {
86-
this._failCallback(error);
87-
this._alreadyErrored = true;
88-
}
89-
return false;
90-
};
91-
AsyncTestZoneSpec.prototype.onScheduleTask = function (delegate, currentZone, targetZone, task) {
92-
if (task.type == 'macroTask' && task.source == 'setInterval') {
93-
this._failCallback('Cannot use setInterval from within an async zone test.');
94-
return;
95-
}
96-
return delegate.scheduleTask(targetZone, task);
97-
};
98-
AsyncTestZoneSpec.prototype.onHasTask = function (delegate, current, target, hasTaskState) {
99-
delegate.hasTask(target, hasTaskState);
100-
if (hasTaskState.change == 'microTask') {
101-
this._pendingMicroTasks = hasTaskState.microTask;
102-
this._finishCallbackIfDone();
103-
}
104-
else if (hasTaskState.change == 'macroTask') {
105-
this._pendingMacroTasks = hasTaskState.macroTask;
106-
this._finishCallbackIfDone();
107-
}
108-
};
109-
return AsyncTestZoneSpec;
110-
}());
111-
// Export the class so that new instances can be created with proper
112-
// constructor params.
113-
Zone['AsyncTestZoneSpec'] = AsyncTestZoneSpec;
114-
})();
115-
116-
117-
/***/ }
118-
/******/ ]);
1+
(function () {
2+
var AsyncTestZoneSpec = (function () {
3+
function AsyncTestZoneSpec(finishCallback, failCallback, namePrefix) {
4+
this._pendingMicroTasks = false;
5+
this._pendingMacroTasks = false;
6+
this._alreadyErrored = false;
7+
this.runZone = Zone.current;
8+
this._finishCallback = finishCallback;
9+
this._failCallback = failCallback;
10+
this.name = 'asyncTestZone for ' + namePrefix;
11+
}
12+
AsyncTestZoneSpec.prototype._finishCallbackIfDone = function () {
13+
var _this = this;
14+
if (!(this._pendingMicroTasks || this._pendingMacroTasks)) {
15+
// We do this because we would like to catch unhandled rejected promises.
16+
this.runZone.run(function () {
17+
setTimeout(function () {
18+
if (!_this._alreadyErrored && !(_this._pendingMicroTasks || _this._pendingMacroTasks)) {
19+
_this._finishCallback();
20+
}
21+
}, 0);
22+
});
23+
}
24+
};
25+
// Note - we need to use onInvoke at the moment to call finish when a test is
26+
// fully synchronous. TODO(juliemr): remove this when the logic for
27+
// onHasTask changes and it calls whenever the task queues are dirty.
28+
AsyncTestZoneSpec.prototype.onInvoke = function (parentZoneDelegate, currentZone, targetZone, delegate, applyThis, applyArgs, source) {
29+
try {
30+
return parentZoneDelegate.invoke(targetZone, delegate, applyThis, applyArgs, source);
31+
}
32+
finally {
33+
this._finishCallbackIfDone();
34+
}
35+
};
36+
AsyncTestZoneSpec.prototype.onHandleError = function (parentZoneDelegate, currentZone, targetZone, error) {
37+
// Let the parent try to handle the error.
38+
var result = parentZoneDelegate.handleError(targetZone, error);
39+
if (result) {
40+
this._failCallback(error);
41+
this._alreadyErrored = true;
42+
}
43+
return false;
44+
};
45+
AsyncTestZoneSpec.prototype.onScheduleTask = function (delegate, currentZone, targetZone, task) {
46+
if (task.type == 'macroTask' && task.source == 'setInterval') {
47+
this._failCallback('Cannot use setInterval from within an async zone test.');
48+
return;
49+
}
50+
return delegate.scheduleTask(targetZone, task);
51+
};
52+
AsyncTestZoneSpec.prototype.onHasTask = function (delegate, current, target, hasTaskState) {
53+
delegate.hasTask(target, hasTaskState);
54+
if (hasTaskState.change == 'microTask') {
55+
this._pendingMicroTasks = hasTaskState.microTask;
56+
this._finishCallbackIfDone();
57+
}
58+
else if (hasTaskState.change == 'macroTask') {
59+
this._pendingMacroTasks = hasTaskState.macroTask;
60+
this._finishCallbackIfDone();
61+
}
62+
};
63+
return AsyncTestZoneSpec;
64+
}());
65+
// Export the class so that new instances can be created with proper
66+
// constructor params.
67+
Zone['AsyncTestZoneSpec'] = AsyncTestZoneSpec;
68+
})();

0 commit comments

Comments
 (0)