{"id":28972630,"url":"https://github.com/ember-cli/ember-try","last_synced_at":"2025-06-24T11:07:25.292Z","repository":{"id":29157866,"uuid":"32688206","full_name":"ember-cli/ember-try","owner":"ember-cli","description":"An ember-cli addon to test against multiple npm dependencies, such as ember and ember-data.","archived":false,"fork":false,"pushed_at":"2025-04-09T03:33:36.000Z","size":8008,"stargazers_count":181,"open_issues_count":49,"forks_count":59,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-06-09T18:27:51.726Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ember-cli.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"emberjs","open_collective":"emberjs"}},"created_at":"2015-03-22T18:11:05.000Z","updated_at":"2025-03-07T22:35:35.000Z","dependencies_parsed_at":"2025-01-04T12:19:59.810Z","dependency_job_id":"93d6ab84-473e-4ae3-aa13-36bb3f5900c8","html_url":"https://github.com/ember-cli/ember-try","commit_stats":{"total_commits":625,"total_committers":48,"mean_commits":"13.020833333333334","dds":0.6335999999999999,"last_synced_commit":"b658992b1f7d1452368ffa8be3232bc6e7797177"},"previous_names":[],"tags_count":53,"template":false,"template_full_name":null,"purl":"pkg:github/ember-cli/ember-try","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ember-cli%2Fember-try","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ember-cli%2Fember-try/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ember-cli%2Fember-try/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ember-cli%2Fember-try/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ember-cli","download_url":"https://codeload.github.com/ember-cli/ember-try/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ember-cli%2Fember-try/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260577540,"owners_count":23030754,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-24T11:07:17.183Z","updated_at":"2025-06-24T11:07:25.280Z","avatar_url":"https://github.com/ember-cli.png","language":"JavaScript","funding_links":["https://github.com/sponsors/emberjs","https://opencollective.com/emberjs"],"categories":[],"sub_categories":[],"readme":"# ember-try\n\n[![npm version](https://badge.fury.io/js/ember-try.svg)](https://badge.fury.io/js/ember-try) [![GitHub Actions Build Status](https://github.com/ember-cli/ember-try/workflows/CI/badge.svg)](https://github.com/ember-cli/ember-try/actions/workflows/ci.yml?query=branch%3Amain) [![Ember Observer Score](http://emberobserver.com/badges/ember-try.svg)](http://emberobserver.com/addons/ember-try) [![Code Climate](https://codeclimate.com/github/ember-cli/ember-try/badges/gpa.svg)](https://codeclimate.com/github/ember-cli/ember-try) [![Test Coverage](https://codecov.io/gh/ember-cli/ember-try/branch/main/graph/badge.svg)](https://codecov.io/gh/ember-cli/ember-try)\n\nAn ember-cli addon to test against multiple dependencies, such as `ember` and `ember-data`.\n\n### Installation\n\n```\nember install ember-try\n```\n\n### Usage\n\nThis addon provides a few commands:\n\n#### `ember try:each`\n\nThis command will run `ember test` or the configured command with each scenario's specified in the config and exit appropriately.\n\nThis command is especially useful to use on CI to test against multiple `ember` versions.\n\nIn order to use an alternate config path or to group various scenarios together in a single `try:each` run, you can use\nthe `--config-path` option.\n\n```\n  ember try:each --config-path=\"config/legacy-scenarios.js\"\n```\n\nIf 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`\nenvironment variable.\n\n#### `ember try:one \u003cscenario\u003e (...options) --- \u003ccommand (Default: ember test)\u003e`\n\nThis 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.\n\nFor example:\n\n```\n  ember try:one ember-beta --- ember test --reporter xunit\n```\n\nor\n\n```\n  ember try:one ember-beta --- ember serve\n```\n\nWhen 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.\n_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._\n\n```\n  ember try:one ember-beta --skip-cleanup=true --- ember test\n```\n\nIn order to use an alternate config path or to group various scenarios, you can use the `--config-path` option.\n\n```\n  ember try:one ember-beta --config-path=\"config/legacy-scenarios.js\"\n```\n\n#### `ember try:reset`\n\nThis 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’.\n\n#### `ember try:ember \u003csemver-string\u003e`\n\nRuns `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.\n\n#### `ember try:config`\n\nDisplays the configuration that will be used. Also takes an optional `--config-path`.\n\n### Config\n\n##### versionCompatibility\n\nIf 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:\n\n```json\n  \"ember-addon\": {\n    \"versionCompatibility\": {\n       \"ember\": \"\u003e2.18.0 \u003c 4.0.0\"\n    }\n  }\n```\n\nThe value for \"ember\" can be any valid [semver statement](https://github.com/npm/node-semver).\nThis 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.\nThese scenarios will ONLY be used if `scenarios` is NOT a key in the configuration file being used.\nIf `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.\n\nTo 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, \"\u003e1.11.0 \u003c=2.0.0\", would (as of writing) run with versions ['1.11.4', '1.12.2', '1.13.13', '2.0.0'].\n\n##### Configuration Files\n\nConfiguration will be read from a file in your ember app in `config/ember-try.js`. Here are the possible options:\n\n```js\nconst getChannelURL = require('ember-source-channel-url');\n\nmodule.exports = async function() {\n  return {\n    /*\n      `command` - a single command that, if set, will be the default command used by `ember-try`.\n      P.S. The command doesn't need to be an `ember \u003csomething\u003e` command, they can be anything.\n      Keep in mind that this config file is JavaScript, so you can code in here to determine the command.\n    */\n    command: 'ember test --reporter xunit',\n    /*\n      `npmOptions` - options to be passed to `npm`.\n    */\n    npmOptions: ['--loglevel=silent'],\n    /*\n      If set to true, the `versionCompatibility` key under `ember-addon` in `package.json` will be used to\n      automatically generate scenarios that will deep merge with any in this configuration file.\n    */\n    useVersionCompatibility: true,\n    /*\n      The package manager to use for all scenarios. By default, lockfiles will be ignored when installing dependencies.\n      At cleanup, all dependencies will be restored to their prior state.\n    */\n    packageManager: 'npm' | 'pnpm' | 'yarn',\n\n    /*\n      buildManagerOptions allows you to opt-out of the default options such as `--ignore-engines --no-lockfile`.\n      The buildManagerOptions function is aware of each scenario so you can customize your options.\n    */\n    buildManagerOptions(scenario) {\n      return ['--ignore-engines'];\n    }\n\n    scenarios: [\n      {\n        name: 'Ember 2.11.0',\n        /*\n          `env` can be set per scenario, with environment variables to set for the command being run.\n          This will be merged with process.env\n       */\n        env: {\n          ENABLE_NEW_DASHBOARD: true\n        },\n        npm: {\n          devDependencies: {\n            'ember-source': '2.11.0'\n          },\n          /*\n            You can optionally define npm or pnpm overrides to enforce a specific dependency version\n            to be installed. This is useful if other libraries you depend on include different\n            versions of a package. This does nothing if `packageManager` is `yarn`;\n          */\n          overrides: {\n            'lodash': '5.0.0'\n          }\n          /*\n            When `packageManager` is `yarn`, you can optionally define yarn resolutions to enforce a\n            specific dependency version to be installed. This is useful if other libraries\n            you depend on include different versions of a package.\n          */\n          resolutions: {\n            'lodash': '5.0.0'\n          }\n          /*\n            In order to easily test multiple editions ember-try merges any `ember` property specified\n            into the applications `package.json`. Values specified in the ember-try configuration will\n            override values that pre-existed in the original `package.json`.\n          */\n          ember: {\n            'edition': 'octane'\n          }\n        }\n      },\n      {\n        name: 'Ember canary with Ember-Data 2.3.0',\n        /*\n          `allowedToFail` - If true, if this scenario fails it will not fail the entire try command.\n        */\n        allowedToFail: true,\n        npm: {\n          devDependencies: {\n            'ember-data': '2.3.0',\n\n            'ember-source': await getChannelURL('canary')\n\n            // you can remove any package by marking `null`\n            'some-optional-package': null\n          }\n        },\n      },\n      {\n        name: 'ember-beta',\n        npm: {\n          devDependencies: {\n            'ember-source': await getChannelURL('beta')\n          }\n        }\n      },\n    ]\n  };\n};\n```\n\nScenarios are sets of dependencies. They can be specified exactly as in the `package.json`\nThe `name` can be used to try just one scenario using the `ember try:one` command.\n\n##### Yarn\n\nIf 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.\n\n##### Pnpm\n\nIf 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.\n\n\u003e ⚠ pnpm versions from 8.0.0 to 8.6.x have the default value of [resolution-mode](https://pnpm.io/npmrc#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 \u003c 8.0.0 and \u003e= 8.7.0.\n\u003e\n\u003e 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.\n\n##### A note on npm scenarios with lockfiles\n\nLockfiles 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`).\nWhen 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.\n\n##### Workspaces\n\nIf you include `useWorkspaces: true` in your `ember-try` config, `ember-try` will apply the diff to each individual workspace specified\nin `package.json`, allowing you to try scenarios in monorepo style repositories. See\n[Yarn's documentation of workspaces](https://yarnpkg.com/lang/en/docs/workspaces/) for more details.\n\n### Video\n\n[![How to use EmberTry](https://i.vimeocdn.com/video/559399937_500.jpg)](https://vimeo.com/157688157)\n\nSee an example of using `ember-try` for CI [here](https://github.com/kategengler/ember-feature-flags/commit/aaf0226975c76630c875cf6b923fdc23b025aa79), and the resulting build [output](https://travis-ci.org/kategengler/ember-feature-flags/builds/55597086).\n\n### Special Thanks\n\n- Much credit is due to [Edward Faulkner](https://github.com/ef4) The scripts in [liquid-fire](https://github.com/ef4/liquid-fire) that test against multiple ember versions were the inspiration for this project.\n\n### Developing\n\n- 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.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fember-cli%2Fember-try","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fember-cli%2Fember-try","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fember-cli%2Fember-try/lists"}