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

fix(patch): fix #744, add namespace to load patch name #774

Merged
merged 3 commits into from
May 19, 2017

Conversation

JiaLiPassion
Copy link
Collaborator

@JiaLiPassion JiaLiPassion commented May 6, 2017

  1. patch node's timer setTimeout with node_timer name
  2. patch fs and events of nodejs with Zone.__load_patch function
  3. make some modification for file structure, zone-node will also have a rollup-main, so we have a clear structure.
  • common (toString, error, promise)
  • browser
  • node
  • mix(electron)

@JiaLiPassion JiaLiPassion changed the title fix(patch): fix #773, add namespace to load patch name fix(patch): fix #744, add namespace to load patch name May 6, 2017
@mhevery mhevery merged commit 89f990a into angular:master May 19, 2017
@JiaLiPassion JiaLiPassion deleted the electron branch July 13, 2017 04:34
// if we are in mix environment, such as Electron,
// the global.setTimeout has already been patched,
// so we just patch timers.setTimeout
return;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JiaLiPassion can you explain how global.setTimeout is patched already? I'm using Zone in mixed environment (Jest with jsdom), and I apparently need global.setTimeout to be patched, so fakeAsync from Angular test utils can work properly. But because it exits early, this line is not reached.

This very line essentially breaks Angular testing with fakeAsync in Jest. We're tracking this under thymikee/jest-preset-angular#65.

Any help appreciated.

@JiaLiPassion
Copy link
Collaborator Author

@thymikee , I will check your repo, in mix environment, the timer will be patched through browser, https://github.com/angular/zone.js/blob/master/lib/browser/browser.ts#L30.

@thymikee
Copy link

thymikee commented Oct 2, 2017

@JiaLiPassion thank you for the answer! I was using dist/zone-node.js because jsdom (simulating browser env) had a bug which had me to fallback from dist/zone.js. Seems like the issue is now fixed and works with current version.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants