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

feat: Add a zone spec for fake async test zone.#330

Merged
juliemr merged 1 commit intoangular:masterfrom
vikerman:fake_async
Apr 19, 2016
Merged

feat: Add a zone spec for fake async test zone.#330
juliemr merged 1 commit intoangular:masterfrom
vikerman:fake_async

Conversation

@vikerman
Copy link
Copy Markdown
Contributor

@vikerman vikerman commented Apr 18, 2016

This implementation is forked from the fake async from Angular 2 and adds the following

  1. Implements own scheduler queue that doesn't depend on the jasmine implementation of a scheduler queue.

  2. Handles errors in timer/microtask callbacks better so that pending timers are removed properly on error (No need for a clearPendingTimers at the end of a test handling errors). The queue processing is stopped after the first error and can be restarted.

  3. Throw an exception if a XMLHttpRequest is used in a fakeAsync test - Useful for avoiding cases for ex. someone uses the online template compiler in a fakeAsync test but forgot to use the template cache and ends up doing a XHR in the test.

@juliemr
Copy link
Copy Markdown
Member

juliemr commented Apr 18, 2016

The Travis error seems to be legitimate.

Comment thread test/zone-spec/fake-async-test.spec.ts Outdated

setTimeout(() => log.push('timer'), 9);

let id = setInterval(() => log.push('periodic timer'), 10);
Copy link
Copy Markdown
Member

@juliemr juliemr Apr 18, 2016

Choose a reason for hiding this comment

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

id is unused

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed.

@juliemr
Copy link
Copy Markdown
Member

juliemr commented Apr 19, 2016

Looks good overall!

@vikerman
Copy link
Copy Markdown
Contributor Author

vikerman commented Apr 19, 2016

Travis error - I need a better way to check whether the macro task is a XHR related call.

@juliemr juliemr merged commit 34159b4 into angular:master Apr 19, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants