ember-try1.2.1 • Public • Published
An ember-cli addon to test against multiple bower and npm dependencies, such as
ember install ember-try
This addon provides a few commands:
This command will run
ember test or the configured command with each scenario's specified in the config and exit appropriately.
This command is especially useful to use on CI to test against multiple
In order to use an alternate config path or to group various scenarios together in a single
try:each run, you can use
ember try:each --config-path="config/legacy-scenarios.js"
If you need to know the scenario that is being run (i.e. to customize a test output file name) you can use the
ember try:one <scenario> (...options) --- <command (Default: ember test)>
This command will run any
ember-cli command with the specified scenario. The command will default to
ember test, if no command is specified on the command-line or in configuration.
ember try:one ember-1.11-with-ember-data-beta-16 --- ember test --reporter xunit
ember try:one ember-1.11-with-ember-data-beta-16 --- ember serve
When running in a CI environment where changes are discarded you can skip resetting your environment back to its original state by specifying --skip-cleanup=true as an option to ember try. Warning: If you use this option and, without cleaning up, build and deploy as the result of a passing test suite, it will build with the last set of dependencies ember try was run with.
ember try:one ember-1.11 --skip-cleanup=true --- ember test
In order to use an alternate config path or to group various scenarios, you can use the
ember try:one ember-1.13 --config-path="config/legacy-scenarios.js"
This command restores the original
node_components and runs
bower install and
npm install. For use if any of the other commands fail to clean up after (they run this by default on completion).
ember try:ember <semver-string>
ember test or the command in config for each version of Ember that is possible under the semver string given. Configuration follows the rules given under the
versionCompatibility heading below.
Displays the configuration that will be used. Also takes an optional
If you're using
ember-try with an Ember addon, there is a short cut to test many Ember versions. In your
package.json under the
ember-addon key, add the following:
The value for "ember" can be any valid semver statement.
This will autogenerate scenarios for each version of Ember that matches the statement. It will also include scenarios for
canary channels of Ember that will be allowed to fail.
These scenarios will ONLY be used if
scenarios is NOT a key in the configuration file being used.
useVersionCompatibility is set to
true in the config file, the autogenerated scenarios will deep merge with any scenarios in the config file. For example, you could override just the
allowedToFail property of the
To keep this from getting out of hand,
ember-try will limit the versions of Ember used to the lasted point release per minor version. For example, ">1.11.0 <=2.0.0", would (as of writing) run with versions ['1.11.4', '1.12.2', '1.13.13', '2.0.0'].
As of v1.0.0, This will only work for projects starting with ember provided by npm, not bower.
Configuration will be read from a file in your ember app in
config/ember-try.js. Here are the possible options:
Scenarios are sets of dependencies (
npm only). They can be specified exactly as in the
name can be used to try just one scenario using the
ember try:one command.
If you include
useYarn: true in your
ember-try config, all npm scenarios will use
yarn for install with the
--no-lockfile option. At cleanup, your dependencies will be restored to their prior state.
A note on npm scenarios with lockfiles
Lockfiles are ignored by
yarn will run with
npm will be run with
When testing various scenarios, it's important to "float" dependencies so that the scenarios are run with the latest satisfying versions of dependencies a user of the project would get.
If you include
useWorkspaces: true in your
ember-try will apply the diff to each individual workspace specified
package.json, allowing you to try scenarios in monorepo style repositories. See
Yarn's documentation of workspaces for more details.
- Much credit is due to Edward Faulkner The scripts in liquid-fire that test against multiple ember versions were the inspiration for this project.
- Be sure to run
npm link ember-try, otherwise any
ember trycommands you run will use the version of ember-try included by ember-cli itself.