Repository navigation
Deprecate ember-mocha - #858
Conversation
caa31f9 to
05400ed
Compare
|
This biggest motivation for me in this change would be removing a confusing branching decision when creating a new ember project. Should I use Mocha? Is it better? What are the pros and cons vs qunit? Are all questions caused by the presence of both of these official testing libs. Removing ember-mocha saves developers from a wheel spinning annoyance very early in their ember experience. |
wagenet
left a comment
There was a problem hiding this comment.
Seems straightforward to me. We should discuss it at this week's meeting.
|
|
||
| ## Drawbacks | ||
|
|
||
| People using `ember-mocha` will have to migrate to using `ember-qunit` instead |
There was a problem hiding this comment.
They'll have to migrate anyway unless someone starts maintaining it, and it doesn't sound like people are leaping at that chance.
There was a problem hiding this comment.
We successfully migrate a bunch (10kloc) of code from Mocha to QUunit using this codemod
https://github.com/1024pix/ember-freshdesk-codemods
The PR is in french though
1024pix/pix#5258
There was a problem hiding this comment.
This is great, thanks for sharing @octo-topi!
There was a problem hiding this comment.
@octo-topi I was amazed by the quality of your pull request. Texts can be auto-translated, no worries.
I think the one-to-one mapping between assertions in mocha and qunit, shown in commit 3, will help other teams with their migration. 💯
There was a problem hiding this comment.
Well, @VincentHardouin is actually the one who has the job done, helped by several other members.
As we have an open-source repository, it was worth share the result so other people can focus on less tedious task.
05400ed to
b70fa32
Compare
|
I'm in favor of deprecating
I imagine, how easily one can migrate from Mocha to QUnit partly depends on if the test suite had been well-maintained (i.e. the experience will be different from one team to another). The |
|
Thanks @jrjohnson and @ijlee2 for your feedback, I'll make sure to incorporate it into the RFC. |
|
Will there be code mods or other tools built to help those that have built code on ember-mocha? I believe Tom assured us that ember was a big tent when it came to testing? |
|
(Also I prefer BDD style :P) |
|
The mocha-to-qunit codemod was already suggested here, so maybe that's an option? |
|
I do think it's unfortunate that there aren't many learning resources, to help teams see how to incrementally migrate a (large) test suite. I found these links today:
The Medium article mentions an in-repo addon that had allowed the team to run Mocha and QUnit side-by-side, but I wasn't able to find the addon if it had been open-sourced. @bertdeblock, maybe you could reach out to the author? In theory, one would first run In practice, a more effective strategy may be to turn off Mocha completely:
Each step corresponds to a separate pull request. Steps 3 and 5 could be split into multiple tasks so that a team of people can work on them in parallel, without running into merge conflicts. |
|
It'd be much nicer if someone were able to adopt/update it, we run a rails
backend with all BDD style tests so that consistency is really helpful for
people looking to contribute in the front and back.
Obviously this is a big lift for someone, I'm no expert in testing
internals so supporting it seems out of my pay grade :P
.joe
…On Fri, Nov 18, 2022 at 1:49 AM Isaac Lee ***@***.***> wrote:
@joegaudet <https://github.com/joegaudet> @bertdeblock
<https://github.com/bertdeblock>
I do think it's unfortunate that there aren't many learning resources, to
help teams see how to incrementally migrate a (large) test suite.
I found these links today:
-
***@***.***/how-we-achieved-green-builds-in-an-enterprise-ember-js-app-be55431ac23e
- https://github.com/ember-codemods/ember-mocha-codemods
The Medium article mentions an in-repo addon that had allowed the team to
run Mocha and QUnit side-by-side, but I wasn't able to find the addon if it
had been open-sourced. @bertdeblock <https://github.com/bertdeblock>,
maybe you could reach out to the author?
In theory, one would first run ember-mocha-codemods to migrate to
recommended testing patterns in Ember v3, then mocha-to-qunit. Everything
just works.
In practice, a more effective strategy may be to turn off Mocha completely:
1.
If tests are run in continuous integration, temporarily set the test
script in package.json to exit 0 (unconditional success).
2.
Uninstall ember-mocha and related packages. Install instead ember-qunit,
eslint-plugin-qunit, qunit, and qunit-dom (refer to the Ember
blueprint for package.json
<https://github.com/ember-cli/ember-cli/blob/v4.9.0-beta.0/blueprints/app/files/package.json>).
Update .eslintrc.js
<https://github.com/ember-cli/ember-cli/blob/v4.9.0-beta.0/blueprints/app/files/.eslintrc.js#L63-L67>
and tests/test-helper.js
<https://github.com/ember-cli/ember-cli/blob/v4.9.0-beta.0/blueprints/app/files/tests/test-helper.ts#L3-L6>.
For a sanity check, visit localhost:4200/tests.
3.
Introduce *default* tests in tests/integration and tests/units, for
every file that is important, e.g. components, routes, etc. Default tests
are ones that Ember CLI creates when you run ember g component-test ...,
ember g route-test ..., etc. They often include a tautology such as
assert.ok(true);. The default tests guarantee that files can be read
in tests and running their code doesn't cause an error.
4.
Update the test script to run tests in continuous integration.
5.
Re-introduce the tests that had been written in Mocha.
Each step corresponds to a separate pull request. Steps 3 and 5 could be
split into multiple tasks so that a team of people can work on them in
parallel, without running into merge conflicts.
—
Reply to this email directly, view it on GitHub
<#858 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAA6IBZTKGGJJHNR563LVB3WI5GKBANCNFSM6AAAAAAR2VK36U>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
|
@joegaudet I don't think anyone is opposed to ember-mocha in concept, but the fact of the matter is that it's unmaintained and no one is stepping up to maintain it. At this point, it's better for us to say it's deprecated instead of acting like it's a viable option for people getting started. I'm strongly opposed to just moving it into adopted addons unless we at least have someone who will make it compatible with Ember 4. To do so now would imply that it has support that it just doesn't have. I don't love this outcome, but I'd prefer to at least be honest about where things stand. |
|
@joegaudet also, don't be so sure to assume the work is out of your pay grade. A lot of this stuff just ends up being a matter of getting your hands dirty and pushing through. If you do want to do the work and the only thing stopping you is feeling unqualified, let's see if we can help get you moving. Everyone starts somewhere! |
|
Fair enough, I was mostly being cheeky, I've been here since the SproutCore
days :P
…On Sun, Nov 20, 2022 at 10:27 AM Peter Wagenet ***@***.***> wrote:
@joegaudet <https://github.com/joegaudet> also, don't be so sure to
assume the work is out of your pay grade. A lot of this stuff just ends up
being a matter of getting your hands dirty and pushing through. If you do
want and the only thing stopping you is feeling unqualified, let's see if
we can help get you moving. Everyone starts somewhere!
—
Reply to this email directly, view it on GitHub
<#858 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAA6IB5PDE3A4FDAFFWSXCTWJJUQ3ANCNFSM6AAAAAAR2VK36U>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
|
Is there a sense of what will be needed to bring it up to date?
.joe
…On Tue, Nov 22, 2022 at 10:30 AM Joe Gaudet ***@***.***> wrote:
Fair enough, I was mostly being cheeky, I've been here since the
SproutCore days :P
On Sun, Nov 20, 2022 at 10:27 AM Peter Wagenet ***@***.***>
wrote:
> @joegaudet <https://github.com/joegaudet> also, don't be so sure to
> assume the work is out of your pay grade. A lot of this stuff just ends up
> being a matter of getting your hands dirty and pushing through. If you do
> want and the only thing stopping you is feeling unqualified, let's see if
> we can help get you moving. Everyone starts somewhere!
>
> —
> Reply to this email directly, view it on GitHub
> <#858 (comment)>, or
> unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AAA6IB5PDE3A4FDAFFWSXCTWJJUQ3ANCNFSM6AAAAAAR2VK36U>
> .
> You are receiving this because you were mentioned.Message ID:
> ***@***.***>
>
|
|
@joegaudet I should have realized the name was familiar! It sounds like ember-mocha doesn't even support Ember 4 yet, so that would be a good start. |
|
FYI, for everyone who is looking to migrate away from ember-mocha, here's a codemod to update your test files. I've already used this to migrate a project I maintain, it was fairly painless. For context I was a maintainer of my own fork of ember-mocha, but could not get it upgraded to Ember 4, as such I decided to abandon ship. |
|
I had tried a couple years back on my personal acct to bump the mocha major version in ember-mocha, but it reached a point where a breaking change felt inevitable. I think this is the situation causing ember-mocha's disrepair:
Anyone who steps up to lead ember-mocha is going to break someone else's tests. They also need a really solid understanding of Ember ecosystem plumbing. And lastly they had to opt-in to mocha in the first place (to have some skin in the game.) I think this basically brings the set of possible maintainers to near-zero. Could anyone spell out what ember-mocha maintainership would even look like? Like what is the role of ember-mocha in the big picture, and how small of a lib should it be to accomplish its goals? Assuming you had to build it from scratch today (which is basically what we need) what would you be signing up to build? |
|
I think we want to do everything in this RFC except actually deprecate the library. We should, however, move it out of the main Ember org and make it clear that it does not support Ember v4 at the moment. If we can establish a new maintainer there's no reason that it can't continue to be used going forwards. |
|
Will try to update the wording soon. |
|
Anyone following along who is interested in taking over maintenance? Should we ask on Discord as well? |
|
@bertdeblock it's seeming like nobody actively wants to take over. We should move forward assuming that there won't be anyone. |
4ab1ac2 to
25d56f5
Compare
25d56f5 to
c9679ba
Compare
|
Updated the RFC a bit, based on some of the comments on this PR. |
|
The framework team gave this a final review today and we've decided to put it in final comment period for the Accepted stage. |
Advance RFC #858 `"Deprecate ember-mocha"` to Stage Ready for Release
Advance RFC #858 `"Deprecate ember-mocha"` to Stage Released
Advance RFC #858 `"Deprecate ember-mocha"` to Stage Recommended
Rendered RFC