Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Application.create().buildInstance() if possible. #237

Merged
merged 3 commits into from
Nov 10, 2017

Conversation

rwjblue
Copy link
Member

@rwjblue rwjblue commented Nov 5, 2017

When the host project properly registers their application, the testing context will now boot a lightweight instance of the application (similar to what FastBoot does).

In this scenario both initializers and instance-initializers will run so no more manual initializer setup shenanigans (as documented here fore mirage). This has been a very long standing point of confusion for folks while testing, and I'm very excited to finally have a path forward that is both performant and intuitive.

For those curious, initializers will run only once for the entire test suite (unlike acceptance tests prior to emberjs/rfcs#268), and the instance-initializers will run once per test (which also mirrors how FastBoot works internally).

This new system nearly identically matches how real applications work in the wild, and is a much less brittle platform for our continued testing "unification".

Fixes #234

@rwjblue rwjblue force-pushed the application-build-instance branch from 292335c to 23b62cb Compare November 6, 2017 01:09
@Turbo87
Copy link
Member

Turbo87 commented Nov 6, 2017

@rwjblue looks like CI is unhappy with this change

@rwjblue
Copy link
Member Author

rwjblue commented Nov 6, 2017

Yep! Still WIP for now. I have a few things to do first (updated with checklist in issue description).

@rwjblue rwjblue force-pushed the application-build-instance branch from 23b62cb to f5ec85a Compare November 8, 2017 04:50
@rwjblue rwjblue force-pushed the application-build-instance branch from 992d524 to 93fc750 Compare November 8, 2017 05:16
Handle the "normal" case of building a application instance instance,
but if using the older "custom resolver" system just fall back to use
the legacy build registry function.
@rwjblue rwjblue changed the title [WIP] Attempt to use Application.create().buildInstance(). Attempt to use Application.create().buildInstance(). Nov 8, 2017
@rwjblue rwjblue requested a review from Turbo87 November 8, 2017 06:07
@rwjblue rwjblue changed the title Attempt to use Application.create().buildInstance(). Use Application.create().buildInstance() if possible. Nov 8, 2017
Copy link
Member

@Turbo87 Turbo87 left a comment

Choose a reason for hiding this comment

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

I have to admit that I have no clue of what I'm looking at here so this is quite hard for me to review 😞

resolve(fullName) {
return registry[fullName] || this._super(...arguments);
},
});
Copy link
Member

Choose a reason for hiding this comment

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

is that going to be required for all apps?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, absolutely not! This is only a thing needed to test things internally here. Basically the setResolverRegistry test helper function (just here in the tests of this repo) resets the list of "known" modules so that we can test things like this.owner.register "wins" over what is resolved, and whatnot.

@rwjblue
Copy link
Member Author

rwjblue commented Nov 8, 2017

I have to admit that I have no clue of what I'm looking at here so this is quite hard for me to review

No problem, thanks for taking a look!

@rwjblue rwjblue merged commit 4de21ab into emberjs:master Nov 10, 2017
@rwjblue rwjblue deleted the application-build-instance branch November 10, 2017 23:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants