Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

ember-try

ember-cli299.8kMIT4.0.0

An ember-cli addon to test against multiple dependencies, such as ember and ember-data.

ember-addon, testing

readme

ember-try

npm version GitHub Actions Build Status Ember Observer Score Code Climate Test Coverage

An ember-cli addon to test against multiple dependencies, such as ember and ember-data.

Installation

ember install ember-try

Usage

This addon provides a few commands:

ember try:each

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 ember versions.

In order to use an alternate config path or to group various scenarios together in a single try:each run, you can use the --config-path option.

  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_CURRENT_SCENARIO environment variable.

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.

For example:

  ember try:one ember-beta --- ember test --reporter xunit

or

  ember try:one ember-beta --- 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-beta --skip-cleanup=true --- ember test

In order to use an alternate config path or to group various scenarios, you can use the --config-path option.

  ember try:one ember-beta --config-path="config/legacy-scenarios.js"

ember try:reset

This command restores all original files, and installs the original node modules again. For use if any of the other commands fail to clean up after (they run this by default on completion) or after running with ‘—skip-cleanup’.

ember try:ember <semver-string>

Runs 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.

ember try:config

Displays the configuration that will be used. Also takes an optional --config-path.

Config

versionCompatibility

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:

  "ember-addon": {
    "versionCompatibility": {
       "ember": ">2.18.0 < 4.0.0"
    }
  }

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 beta and 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. If 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 ember-beta scenario.

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'].

Configuration Files

Configuration will be read from a file in your ember app in config/ember-try.js. Here are the possible options:

const getChannelURL = require('ember-source-channel-url');

module.exports = async function() {
  return {
    /*
      `command` - a single command that, if set, will be the default command used by `ember-try`.
      P.S. The command doesn't need to be an `ember <something>` command, they can be anything.
      Keep in mind that this config file is JavaScript, so you can code in here to determine the command.
    */
    command: 'ember test --reporter xunit',
    /*
      `npmOptions` - options to be passed to `npm`.
    */
    npmOptions: ['--loglevel=silent'],
    /*
      If set to true, the `versionCompatibility` key under `ember-addon` in `package.json` will be used to
      automatically generate scenarios that will deep merge with any in this configuration file.
    */
    useVersionCompatibility: true,
    /*
      The package manager to use for all scenarios. By default, lockfiles will be ignored when installing dependencies.
      At cleanup, all dependencies will be restored to their prior state.
    */
    packageManager: 'npm' | 'pnpm' | 'yarn',

    /*
      buildManagerOptions allows you to opt-out of the default options such as `--ignore-engines --no-lockfile`.
      The buildManagerOptions function is aware of each scenario so you can customize your options.
    */
    buildManagerOptions(scenario) {
      return ['--ignore-engines'];
    }

    scenarios: [
      {
        name: 'Ember 2.11.0',
        /*
          `env` can be set per scenario, with environment variables to set for the command being run.
          This will be merged with process.env
       */
        env: {
          ENABLE_NEW_DASHBOARD: true
        },
        npm: {
          devDependencies: {
            'ember-source': '2.11.0'
          },
          /*
            You can optionally define npm or pnpm overrides to enforce a specific dependency version
            to be installed. This is useful if other libraries you depend on include different
            versions of a package. This does nothing if `packageManager` is `yarn`;
          */
          overrides: {
            'lodash': '5.0.0'
          }
          /*
            When `packageManager` is `yarn`, you can optionally define yarn resolutions to enforce a
            specific dependency version to be installed. This is useful if other libraries
            you depend on include different versions of a package.
          */
          resolutions: {
            'lodash': '5.0.0'
          }
          /*
            In order to easily test multiple editions ember-try merges any `ember` property specified
            into the applications `package.json`. Values specified in the ember-try configuration will
            override values that pre-existed in the original `package.json`.
          */
          ember: {
            'edition': 'octane'
          }
        }
      },
      {
        name: 'Ember canary with Ember-Data 2.3.0',
        /*
          `allowedToFail` - If true, if this scenario fails it will not fail the entire try command.
        */
        allowedToFail: true,
        npm: {
          devDependencies: {
            'ember-data': '2.3.0',

            'ember-source': await getChannelURL('canary')

            // you can remove any package by marking `null`
            'some-optional-package': null
          }
        },
      },
      {
        name: 'ember-beta',
        npm: {
          devDependencies: {
            'ember-source': await getChannelURL('beta')
          }
        }
      },
    ]
  };
};

Scenarios are sets of dependencies. They can be specified exactly as in the package.json The name can be used to try just one scenario using the ember try:one command.

Yarn

If you include packageManager: 'yarn' 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.

Pnpm

If you include packageManager: 'pnpm' in your ember-try config, all npm scenarios will use pnpm for install with the --no-lockfile options. At cleanup, your dependencies will be restored to their prior state.

⚠ pnpm versions from 8.0.0 to 8.6.x have the default value of resolution-mode setting changed to lowest-direct. This violates ember-try expectations as resolution-mode is expected to be highest, like in npm and pnpm versions < 8.0.0 and >= 8.7.0.

If you run into this issue, we recommend to upgrade pnpm to latest version. If you are unable to upgrade, you can set resolution-mode = highest in the .npmrc file.

A note on npm scenarios with lockfiles

Lockfiles are ignored by ember-try. (yarn will run with --no-lockfile and npm will be run with --no-package-lock and pnpm will be run with --no-lockfile). 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.

Workspaces

If you include useWorkspaces: true in your ember-try config, ember-try will apply the diff to each individual workspace specified in package.json, allowing you to try scenarios in monorepo style repositories. See Yarn's documentation of workspaces for more details.

Video

How to use EmberTry

See an example of using ember-try for CI here, and the resulting build output.

Special Thanks

  • Much credit is due to Edward Faulkner The scripts in liquid-fire that test against multiple ember versions were the inspiration for this project.

Developing

  • Be sure to run npm link and npm link ember-try, otherwise any ember try commands you run will use the version of ember-try included by ember-cli itself.

changelog

Changelog

Release (2025-03-07)

ember-try 4.0.0 (major)

:boom: Breaking Change

:rocket: Enhancement

  • ember-try
    • #1025 Support a packageManager option (instead of usePnpm and useYarn) (@bertdeblock)
    • #965 Use the system's temp folder for backing up package-manager files (@bertdeblock)

:bug: Bug Fix

:memo: Documentation

  • ember-try
    • #807 Use scenario names available in default addon blueprint (@jelhan)

:house: Internal

Committers: 6

v3.0.0 (2023-08-16)

:boom: Breaking Change

:rocket: Enhancement

:memo: Documentation

:house: Internal

Committers: 3

v3.0.0-beta.1 (2023-03-01)

:boom: Breaking Change

:bug: Bug Fix

  • #912 Downgraded fs-extra version to 6.x to fix a fs.copy related issue. (@larry-x-yu)

:memo: Documentation

:house: Internal

  • #788 tests/npm-adapter: Use async/await instead of promise chains (@Turbo87)

Committers: 4

v2.0.0 (2021-11-04)

:boom: Breaking Change

:rocket: Enhancement

:bug: Bug Fix

:house: Internal

Committers: 4

v1.4.0

Full Changelog

Implemented enhancements:

  • Add support for merging/clobbering ember in package.json. #429 (rwjblue)

v1.3.0

Full Changelog

Merged pull requests:

v1.2.1

Full Changelog

Merged pull requests:

v1.2.0

Full Changelog

Merged pull requests:

v1.1.0 (2018-09-25)

Full Changelog

Closed issues:

  • [Security] Cut stable release with upgraded lodash or cli-table3 #200
  • npm prune --no-shrinkwrap removes packages declared with github:repo\#hash syntax #170

Merged pull requests:

  • [feat] Adds support for Yarn/NPM workspaces #209 (pzuraq)

v1.0.0 (2018-08-30)

Full Changelog

Merged pull requests:

v1.0.0-beta.6 (2018-08-30)

Full Changelog

v1.0.0-beta.5 (2018-08-30)

Full Changelog

v1.0.0-beta.4 (2018-08-30)

Full Changelog

Closed issues:

  • A function in the Route to just leave current route, whatever it is. #199
  • ember try:ember dies after first failed scenario with 1.0.0-beta.3 #197
  • Tests not rebuilding on an ember try scenario #190

Merged pull requests:

v1.0.0-beta.3 (2018-05-15)

Full Changelog

v1.0.0-beta.2 (2018-05-15)

Full Changelog

Closed issues:

  • Failing scenario for 1.13 after updating to 3.0 #187
  • Travis and yarn issue on Ember 2.12 only #148
  • Be smart about versions of Ember where version is provided by bower and where versions are provided by npm #91

Merged pull requests:

v1.0.0-beta.1 (2018-02-09)

Full Changelog

Merged pull requests:

v1.0.0-beta.0 (2018-02-07)

Full Changelog

Implemented enhancements:

  • Remove deprecated commands #163

Closed issues:

  • How might I get only one of my scenarios to run my after_success deploy script? #180
  • Remove "default config"? #177
  • Deprecate support for top-level dependencies under a scenario #162

Merged pull requests:

v0.2.23 (2018-01-13)

Full Changelog

Fixed bugs:

Closed issues:

  • Feature Request: support promises in dependencies... #172

Merged pull requests:

v0.2.22 (2017-11-14)

Full Changelog

Merged pull requests:

  • Do not issue warning when including ember-try in project's package.json. #166 (rwjblue)

v0.2.21 (2017-11-14)

Full Changelog

Merged pull requests:

  • update ember-cli-version-checker #165 (ef4)

v0.2.20 (2017-11-13)

Full Changelog

Fixed bugs:

  • Error: Cannot find module 'bower' #161
  • Ensure bower is not required when no bower dependencies are present. #164 (rwjblue)

Closed issues:

  • bower version #131
  • Ember-try uses Yarn in Travis CI Trusty Build #125
  • Allow user to disable beta, canary when using versionCompatability #86

Merged pull requests:

  • Clean up all-commands.sh to remove deprecated commands #160 (kategengler)

v0.2.19 (2017-11-12)

Full Changelog

Fixed bugs:

  • versionCompatibility caching #112

Closed issues:

  • Scenarios missing their deps when no bower and no package-lock.json #150
  • try:each fails with paths containing spaces and parens #149
  • ember-cli module directory emptied of files #141

Merged pull requests:

v0.2.18 (2017-11-06)

Full Changelog

Implemented enhancements:

  • Order versionCompatibility scenarios by semver #128

Closed issues:

  • Ignore package-lock.json by default #144
  • yarn detection isn't complete #133

Merged pull requests:

v0.2.17 (2017-09-08)

Full Changelog

Closed issues:

  • useYarn: true causes ember try:each to fail #147

Merged pull requests:

v0.2.16 (2017-07-16)

Full Changelog

Fixed bugs:

Closed issues:

  • ember-try fails with default addon app + ember-cli-sass #126
  • Does ember-try-config need to be a dev dependency? #77

Merged pull requests:

v0.2.15 (2017-05-31)

Full Changelog

Merged pull requests:

v0.2.14 (2017-04-22)

Full Changelog

Merged pull requests:

  • Move ember-cli-babel to a devDependency. #124 (rwjblue)
  • Make "ember-cli-babel" dev dependency #123 (Turbo87)

v0.2.13 (2017-03-28)

Full Changelog

Closed issues:

  • Failing in Travis with Error: Cannot find module './../utils/result-summary' #121

Merged pull requests:

v0.2.12 (2017-03-24)

Full Changelog

Merged pull requests:

v0.2.11 (2017-03-16)

Full Changelog

Closed issues:

  • Support running bower scenarios even if the app does not initially have a bower.json #110

Merged pull requests:

v0.2.10 (2017-02-21)

Full Changelog

Closed issues:

  • Having trouble figuring out how to try versions of ember-data #111

Merged pull requests:

  • Leverage command return value instead of process.exit. #114 (rwjblue)

v0.2.9 (2017-01-15)

Full Changelog

Merged pull requests:

  • Install bower if not installed and required by scenarios #109 (kategengler)

v0.2.8 (2016-11-01)

Full Changelog

Closed issues:

  • Command from config cannot include multiple command with | or && #94
  • Allow using environment variables in command. #87

Merged pull requests:

  • Allow chained commands and setting env vars in commands #107 (kategengler)
  • Run a subset of commands in Windows CI as a smoke-test #97 (kategengler)

v0.2.7 (2016-10-30)

Full Changelog

Closed issues:

  • Add API for removing packages #104
  • A #103
  • Add ability for yarn to replace bower executable #102
  • make bower optional #101
  • Running command silently contains ember-try installation output #99
  • ember-try-config messing with shrinkwrap #80
  • Can we use bower's programmatic api? #42

Merged pull requests:

v0.2.6 (2016-09-28)

Full Changelog

Fixed bugs:

  • Deprecation warning for Ember CLI below v2.6.0 #83

Merged pull requests:

v0.2.5 (2016-08-03)

Full Changelog

Fixed bugs:

  • Deprecation warning for Ember CLI below v2.6.0 #84

Merged pull requests:

v0.2.4 (2016-06-21)

Full Changelog

Merged pull requests:

v0.2.3 (2016-06-21)

Full Changelog

Closed issues:

  • slow require times #74
  • ember try is grabbing more than release/beta #72
  • When using ember try:each, npm install doesn't always seem to be executed #70
  • [Proposal] Blueprinted scenarios #55

Merged pull requests:

  • Move costly requires to be lazy. #75 (rwjblue)
  • Fix deprecation message for ember try command. #73 (rwjblue)
  • Warn if addon or app is using ember-try in package.json, it's now included in ember-cli #71 (kategengler)
  • Update README.md #69 (MiguelMadero)
  • Added "How to use EmberTry" from Global Ember Meetup #68 (taras)

v0.2.2 (2016-03-15)

Full Changelog

v0.2.1 (2016-03-13)

Full Changelog

Merged pull requests:

  • Add some output between scenarios to make the output easier to parse in case of failures #67 (kategengler)
  • Make config file able to export a function #66 (kategengler)
  • Add ability to auto-generate scenarios from a versionCompatibility statement in package.json #65 (kategengler)
  • Some reorganization + adding debug #64 (kategengler)
  • Add coverage & codeclimate config #63 (kategengler)

v0.2.0 (2016-02-20)

Full Changelog

Closed issues:

  • ember try:testall should honor all or a subset of 'ember test' arguments #43
  • Add a parameter to the scenarios to warn on failure instead of fail #4

Merged pull requests:

  • New configuration option allowedToFail per scenario. #62 (kategengler)
  • Add 'bowerOptions' and 'npmOptions' as top level configuration options #61 (kategengler)
  • Add ember try:one \<scenario\> \(...options\) --- \<command\> #60 (kategengler)
  • Make commands configurable and add try:each command, soft-deprecating testall #59 (kategengler)

v0.1.3 (2016-02-16)

Full Changelog

Closed issues:

  • [enhancement] Enable writing test results to file #30

Merged pull requests:

  • Fix bug: options were not being passed to the command run by try #58 (kategengler)
  • Quiet npm warnings by appeasing it with changes to the fixture package.json #57 (kategengler)
  • Just passing --skip-cleanup isn't enough #56 (kategengler)
  • Refactor so that ScenarioManager doesn't need to know about config #54 (kategengler)

v0.1.2 (2016-02-04)

Full Changelog

Closed issues:

  • Table cell width / alignment issues in some scenarios. #46

Merged pull requests:

  • Expose environment variable for currently running scenario. #52 (rwjblue)
  • Use cli-table2. #51 (rwjblue)

v0.1.1 (2016-02-01)

Full Changelog

Closed issues:

  • bower.json reset to first run, not initial value. #47
  • [enhancement] Handle ember and ember data as addons #44

Merged pull requests:

  • Allow --config-path to be specified to ember-try commands. #50 (rwjblue)
  • Remove .only so all node tests can run. #49 (rwjblue)
  • Simplify npm scripts. #48 (rwjblue)

v0.1.0 (2016-01-29)

Full Changelog

Closed issues:

  • What is the most convenient way to execute ember-try builds concurrently on Linux? #40
  • CI Pipeline #38

Merged pull requests:

v0.0.8 (2015-07-24)

Full Changelog

Closed issues:

  • Removing ember-data causes error #35
  • Failing on Travis #27
  • try:testall does not appear in help #22

Merged pull requests:

v0.0.7 (2015-06-03)

Full Changelog

Merged pull requests:

v0.0.6 (2015-06-02)

Full Changelog

Closed issues:

  • Add tmp dir to the .npmignore. #23

Merged pull requests:

  • add tmp dir to npmignore fix #23 #24 (odoe)

v0.0.5 (2015-04-20)

Full Changelog

Closed issues:

  • Killing ember-try while it's running leaves bower.json modified #20
  • Ability to configure a minimum version for "testall" #19
  • Add a hook for after successful test #15
  • Add ability to pass command line options when using ember try beta \<command\>. #10

Merged pull requests:

v0.0.4 (2015-04-05)

Full Changelog

Closed issues:

  • Fails when Bower is not globally installed. #11
  • New version? #7

Merged pull requests:

  • Do not require global bower or ember commands. #12 (rwjblue)

v0.0.3 (2015-04-04)

Full Changelog

Closed issues:

  • Running an individual scenario with ember try returns a nonzero exit code when all tests pass #5
  • Allow testing of beta and canary versions. #3

Merged pull requests:

  • Remove dependency on git; manage original version of bower.json #9 (kategengler)
  • Replace Task model with CoreObject #8 (kategengler)
  • fixes #3: remove actual version check and preserve resolutions #6 (habdelra)

v0.0.2 (2015-03-31)

Full Changelog

Merged pull requests:

v0.0.1 (2015-03-24)