Skip to content

fix(testing): add an explicit doAsyncPrecompilation step - #10015

Merged
juliemr merged 1 commit into
angular:masterfrom
juliemr:7-12-testbed
Jul 20, 2016
Merged

juliemr merged 1 commit into
angular:masterfrom
juliemr:7-12-testbed

Conversation

@juliemr

@juliemr juliemr commented Jul 12, 2016

Copy link
Copy Markdown
Contributor

This removes the magic from the inject test helper that would inspect
the current zone and would only work with our async test helper.
Now, inject is always synchronous, and if you are using a module
that requires async precompilation, you're required to call
doAsyncPrecompilation in your tests.

This is part of the breaking changes introduced with the swap
to each test having an AppModule.

Also, cleans up some APIs and renames TestInjector to TestBed.

Closes #9975
Closes #9593

@juliemr juliemr added area: testing Issues related to Angular testing features, such as TestBed action: review The PR is still awaiting reviews from at least one requested reviewer labels Jul 12, 2016
@juliemr juliemr added this to the 2.0.0-rc.5 milestone Jul 12, 2016

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.

Cleanup: remove this comment.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

"{ return" is not needed

@juliemr juliemr Jul 13, 2016 •

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.

tsc complains without it, I think because of the object syntax.

@juliemr
juliemr force-pushed the 7-12-testbed branch 4 times, most recently from 9a1265a to 5e07b9c Compare July 13, 2016 20:11
@juliemr

juliemr commented Jul 13, 2016

Copy link
Copy Markdown
Contributor Author

Done, and Travis is happy again. Please take a look!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

do you also want to rename the file to test_bed.ts?

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.

done!

@IgorMinar

Copy link
Copy Markdown
Contributor

otherwise lgtm

@IgorMinar IgorMinar added action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews pr_state: LGTM and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Jul 20, 2016
This removes the magic from the `inject` test helper that would inspect
the current zone and would only work with our `async` test helper.
Now, `inject` is always synchronous, and if you are using a module
that requires async precompilation, you're required to call
`doAsyncPrecompilation` in your tests.

This is part of the breaking changes introduced with the swap
to each test having an AppModule.

Closes angular#9975
Closes angular#9593

BREAKING CHANGE:

`TestInjector` is now renamed to `TestBed`

Before:

```js
import {TestInjector, getTestInjector} from '@angular/core/testing';
```

After:

```js
import {TestBed, getTestBed} from '@angular/core/testing';
```
@juliemr juliemr removed the action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews label Jul 20, 2016
@juliemr

juliemr commented Jul 20, 2016

Copy link
Copy Markdown
Contributor Author

Thanks! Waiting on Travis and then I'll merge.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area: testing Issues related to Angular testing features, such as TestBed cla: yes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Review API for inject now that we have app modules Rename TestInjector to TestBed

4 participants