This repository has been archived by the owner on Feb 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 408
fakeAsync in node throws TypeError: Cannot read property 'length' of undefined
#760
Comments
The issue is that the The fix is to have |
I will try to fix it. |
JiaLiPassion
added a commit
to JiaLiPassion/zone.js
that referenced
this issue
Apr 27, 2017
… with additional args
JiaLiPassion
added a commit
to JiaLiPassion/zone.js
that referenced
this issue
Apr 27, 2017
… with additional args
@tbosch , I have fixed it in #762, could you please use the attached dist.zip to test it is ok or not? it('should be able to schedule microTask with additional arguments', () => {
const process = global['process'];
const nextTick = process && process['nextTick'];
if (!nextTick) {
return;
}
fakeAsyncTestZone.run(() => {
let tickRun = false;
let cbArgRun = false;
nextTick(
(strArg: string, cbArg: Function) => {
tickRun = true;
expect(strArg).toEqual('stringArg');
cbArg();
},
'stringArg',
() => {
cbArgRun = true;
});
expect(tickRun).toEqual(false);
testZoneSpec.flushMicrotasks();
expect(tickRun).toEqual(true);
expect(cbArgRun).toEqual(true);
});
}); I think it should work! |
@JiaLiPassion yes, this is working now, thanks! |
@tbosch , ok, got it! thank you for confirm. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Node 6.9.5.
Stack:
This happens after the test is done and
fakeAsync
flushes the microtasks.The code in
_stream_writable.js
is from node, and contains the following:The error above occurs because the call to
process.nextTick
does not forward the extra arguments to theafterWrite
callback when it happens.Workaround / patch in
zone-node.js
:I.e. bind the arguments early to the callback, so that
fakeAsync
does not have to pass them anymore.Note that this is probably a design bug as:
Zone.current.scheduleMicroTask
contains method specific knowledge (in this case that the remaining argument have to be passed to the callback)fakeAsync
is never calling this callback.The text was updated successfully, but these errors were encountered: