Skip to content

Add MU support to blueprints test helpers - #153

Merged
mixonic merged 1 commit into
ember-cli:masterfrom
dcyriller:ember-new-mu-support
Sep 14, 2018
Merged

mixonic merged 1 commit into
ember-cli:masterfrom
dcyriller:ember-new-mu-support

Conversation

@dcyriller

@dcyriller dcyriller commented Jul 5, 2018 •

Copy link
Copy Markdown
Collaborator

This PR unlocks the ability to do:
emberNew({ isModuleUnification: true })
or
emberGenerateDestroy({ isModuleUnification: true })

It would be especially usefull for testing blueprints in ember.js and ember-data repos + addons.

@dcyriller

Copy link
Copy Markdown
Collaborator Author

🤔 the tests failure doesn't seem to be related to the PR

@Turbo87

Turbo87 commented Jul 5, 2018

Copy link
Copy Markdown
Member

can you add tests for that?

@dcyriller

Copy link
Copy Markdown
Collaborator Author

Sure, I'll do it. I have to figure out how to test emberNew.

@dcyriller

Copy link
Copy Markdown
Collaborator Author

Okay @Turbo87 I added a test for that.

@Turbo87 Turbo87 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

thanks for working on this @dcyriller! the change itself looks fine to me, but I'd prefer if we could extract the unrelated CI changes to a dedicated PR.

Comment thread .travis.yml Outdated
- '10'
- '8'
- '6'
- '4'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

can you extract these changes to a separate PR? if we bump the required Node versions then it's a breaking change and deserves a dedicated PR so that we can label it properly in the changelog.

@Turbo87
Turbo87 requested a review from rwjblue July 10, 2018 10:31
@dcyriller

Copy link
Copy Markdown
Collaborator Author

I updated the PR, thanks for the review @Turbo87

Here is the link to the CI update: #155

It was required since this PR upgrades ember-cli to v3.2 (do not support nodejs v4 anymore).

@runspired

Copy link
Copy Markdown

Just wanted to drop by and say thanks to @dcyriller for doing this :) Looking forward to having MU blueprints for ember-data :D

Comment thread lib/ember-new.js Outdated
disableDependencyChecker: true
};

process.env["MODULE_UNIFICATION"] = !!options.isModuleUnification;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should be EMBER_CLI_MODULE_UNIFICATION I think 🤔...

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The tests I added are failing when updating to EMBER_CLI_MODULE_UNIFICATION. I'll investigate why.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Okay, I get it! ember-cli/ember-cli#7869 is still on ember-cli's beta branch. Next ember-cli release, it should be good. :)

@mixonic

mixonic commented Jul 23, 2018 •

Copy link
Copy Markdown
Member

Had some discussion about this with @rwjblue at our meeting this morning. The generators need to test a matrix of things:

  • If the module unification feature flag for Ember CLI is enabled, new projects with generate with a src/.
  • Existing projects with an app/ should continue to use classic blueprints regardless of if the feature flag is enabled. If there is a src/ folder, then the mu blueprints should be used.

The test helper needs to have a way to test both of these things (flag enabled or not, type of directory).

Edit: Upon some further discussion!

  • Let's make sure the ENV value gets cleaned up at the end of each test.
  • Let's also add these arguments to emberGenerate and emberGenerateDestroy and friends. Basically you will want to be able to run emberNew().then(() => emberGenerateDestroy({isModuleUnification: true})) and assert that the classic blueprints work (b/c the app only has an app/ dir, since it was generated as a classic app).

@dcyriller

dcyriller commented Jul 23, 2018 •

Copy link
Copy Markdown
Collaborator Author

Ok @mixonic I'll update the PR to cover these different scenarios soon.

Something remains unclear to me though. It looks to me that experiments are enabled on ember-cli's master branch only. I mean, I can't use them from released ember-cli versions. How will I be able to set EMBER_CLI_MODULE_UNIFICATION variable?

@dcyriller dcyriller changed the title Add MU support to ember new test helper Add MU support to blueprints test helpers Aug 6, 2018
@dcyriller

dcyriller commented Aug 6, 2018 •

Copy link
Copy Markdown
Collaborator Author

Taken individually, all tests are passing! 🎉

But because they are run on the same process, they fail when run in sequence.

Indeed, the experiments object is put in cache by nodejs runtime. And when execution comes to the MU part of the tests, it fails because it resolves experiments.MODULE_UNIFICATION to undefined.

A solution would be to turn this object into a function. I implemented it in ember-cli/ember-cli#7961

What do you think @rwjblue?

@dcyriller

Copy link
Copy Markdown
Collaborator Author

If using ember-cli canary is not too much of an issue, the PR is now ready for review! All tests are passing.

@dcyriller

Copy link
Copy Markdown
Collaborator Author

An example of usage here: warp-drive-data/warp-drive#5558

@dcyriller

Copy link
Copy Markdown
Collaborator Author

@rwjblue @mixonic if you have time for this, your reviews are welcomed :)

This would unlock MU support for ember-data blueprints (+ prepare the ground to improve ember-source blueprints testing).

Comment thread package.json
},
"devDependencies": {
"ember-cli": "~2.16.0",
"ember-cli": "github:ember-cli/ember-cli",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can this reference a specific version, or does it still need to be pinned to canary?

@dcyriller dcyriller Sep 11, 2018 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It still needs to be pinned to canary for now, as it requires this ember-cli's PR ember-cli/ember-cli#7961 (not yet on beta branch).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Chatted with @rwjblue and he is 👍 on this, at least as a temporary solution.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Great! Thank you @mixonic. I'll update to a published ember-cli version when available.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Do you think it could be released?

@mixonic
mixonic merged commit 4b31f1e into ember-cli:master Sep 14, 2018
@dcyriller
dcyriller deleted the ember-new-mu-support branch September 14, 2018 18:01
This was referenced Sep 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants