|
| 1 | +- Start Date: 2018-12-24 |
| 2 | +- RFC PR: (leave this empty) |
| 3 | +- Ember Issue: (leave this empty) |
| 4 | + |
| 5 | +# Build in ember-exam |
| 6 | + |
| 7 | +## Summary |
| 8 | + |
| 9 | +This RFC proposes to promote [Ember-exam](https://github.com/ember-cli/ember-exam)'s functionality |
| 10 | +to be a core part of the developer workflow. |
| 11 | + |
| 12 | +## Motivation |
| 13 | + |
| 14 | +Ember cares greatly about compatibility. Every addon is generated with a config file for `ember-try` |
| 15 | +to ensure the code is tested in the last two LTS version of Ember and with the upcoming _beta_ and _canary_ |
| 16 | +channels. |
| 17 | + |
| 18 | +We are doing great but we can still do better. |
| 19 | + |
| 20 | +Fast test suites are critical to the adoption of good testing practices. |
| 21 | +Testing in several browsers is, specially in addons, important to ensure your code will run correctly |
| 22 | +for all your users and to keep the web open. |
| 23 | + |
| 24 | +Although testing in multiple browsers is already possible today out of the box with no extra pieces, |
| 25 | +going from one browser to two doubles the testing time and it is a burden for many people. |
| 26 | + |
| 27 | +[Ember-exam](https://github.com/ember-cli/ember-exam) is an fantastic addon that allows users to |
| 28 | +run their tests in parallel in different browsers or even split their suite in chunks and run it |
| 29 | +in several instances of the same browser. It allows users to run their tests in a fraction of the time |
| 30 | +or increase the number of tested browsers without worsening the feedback loop. |
| 31 | + |
| 32 | +It is just too good for an opinionated framework like Ember.js to not advocate its usage. |
| 33 | + |
| 34 | +## Detailed design |
| 35 | + |
| 36 | +There are two different approaches for this goal, listed in order of complexity: |
| 37 | + |
| 38 | +### Add ember-exam to the default blueprint for apps and addons |
| 39 | + |
| 40 | +This approach yields a good return with a relative low effort. Including it by default on newly generated |
| 41 | +projects signals its usages as a desirable good practice. Ember-exam is already part of the ember-cli |
| 42 | +organization so there shouldn't be a problem controlling the code. |
| 43 | + |
| 44 | +Developers can totally opt out by just removing the addon should they want to. |
| 45 | + |
| 46 | +The downside of this approach is that we cannot just assume that everybody will have Ember-exam installed |
| 47 | +in ember-cli if we wanted to build some advanced feature (like testing tailor-made per-browser builds). |
| 48 | + |
| 49 | +### Merge ember-exams functionality into the testing experience. |
| 50 | + |
| 51 | +A more involved approach consists on moving the code that powers ember-exam builds into the relevant |
| 52 | +libraries (ember-cli / ember-test-loader / ember-qunit / ember-cli-mocha) and discontinuing Ember-exam as a separate tool. |
| 53 | + |
| 54 | +This would mean Ember completely embraces parallel multi-browser testing at its core. |
| 55 | + |
| 56 | +### Default configuration |
| 57 | + |
| 58 | +In both scenarios we can start with a parallel count of 1, meaning parallel builds are still opt-in. |
| 59 | +With this default configuration and testing on a single browser there won't be any discernible difference |
| 60 | +from how things work today out of the box. |
| 61 | + |
| 62 | +User will only have to make a change in the testem config file to start getting the advantages of parallel testing. |
| 63 | + |
| 64 | +## How we teach this |
| 65 | + |
| 66 | +The testing section of the guides will have to be amended to include information about parallel builds |
| 67 | +and multi-browser testing. |
| 68 | + |
| 69 | +## Drawbacks |
| 70 | + |
| 71 | +Adding new features to the default Ember experience means more code to maintain and more |
| 72 | +features to teach for new users, who already have plenty on their plate. |
| 73 | + |
| 74 | +We can limit the teaching impact of parallel builds by defaulting to 1, but does not remove it completely. |
| 75 | + |
| 76 | +## Alternatives |
| 77 | + |
| 78 | +Leave ember-exam as the nice addon it is today so users who care the most for speed or multi-browser |
| 79 | +support install it. |
| 80 | + |
| 81 | +## Unresolved questions |
| 82 | + |
| 83 | +By default Ember addons are only tested in headless chrome. Although it's not _directly_ related parallel |
| 84 | +testing it could make multi-browser testing cheap enough to change the defaults so addons are tested in both |
| 85 | +chrome and firefox, ensuring better compatibility. |
0 commit comments