{"id":15321,"library":"ember-try","title":"Ember Try","description":"Ember Try is an Ember CLI addon designed to facilitate testing Ember applications and addons against various versions of their dependencies, particularly `ember` and `ember-data`. The current stable version is 4.0.0, released in March 2025. It allows developers to define \"scenarios\" that modify `package.json` dependencies, install them, run a specified command (usually `ember test`), and then revert the changes. This is crucial for maintaining compatibility across different Ember ecosystem versions. Its primary differentiators include deep integration with `ember-cli`, a declarative configuration for scenarios, and commands like `ember try:each` for iterative testing and `ember try:one` for specific scenario runs. It also supports automatic scenario generation based on `semver` ranges in `package.json` via its `versionCompatibility` feature, making it a cornerstone for robust Ember ecosystem testing. The release cadence appears tied to major Ember CLI or Node.js ecosystem shifts, with major versions released periodically to address breaking changes and new features.","status":"active","version":"4.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/ember-cli/ember-try","tags":["javascript","ember-addon","testing"],"install":[{"cmd":"npm install ember-try","lang":"bash","label":"npm"},{"cmd":"yarn add ember-try","lang":"bash","label":"yarn"},{"cmd":"pnpm add ember-try","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"As an Ember CLI addon, it integrates directly with and requires an Ember CLI project environment to function.","package":"ember-cli","optional":false}],"imports":[{"note":"Configuration is typically defined by exporting a function from `config/ember-try.js`. Since v4.0.0, the `project` instance is no longer passed as an argument to this function.","wrong":"// config/ember-try.js\nimport { scenarios } from 'ember-try'; // Incorrect; configuration is a CommonJS module export.","symbol":"default export (config function)","correct":"// config/ember-try.js\nmodule.exports = function(/* app */) {\n  return {\n    scenarios: [\n      {\n        name: 'ember-lts-4.4',\n        npm: {\n          devDependencies: {\n            'ember-source': '~4.4.0'\n          }\n        }\n      },\n      {\n        name: 'ember-beta',\n        npm: {\n          devDependencies: {\n            'ember-source': 'beta'\n          }\n        }\n      }\n    ]\n  };\n};"},{"note":"This is a declarative configuration within `package.json` for auto-generating scenarios based on semver ranges, not a direct JavaScript import.","wrong":"// package.json\n{\n  \"ember-addon\": {\n    \"versionCompatibility\": \"^3.28.0\" // Not a valid object structure for defining compatibility\n  }\n}","symbol":"versionCompatibility (package.json)","correct":"// package.json\n{\n  \"ember-addon\": {\n    \"versionCompatibility\": {\n      \"ember\": \">=3.28.0 <5.0.0\"\n    }\n  }\n}"},{"note":"The primary interaction with `ember-try` is through `ember` CLI commands, which are made available after addon installation. There are no direct JavaScript imports for these commands.","symbol":"CLI Commands","correct":"ember try:each\nember try:one ember-beta --- ember test\nember try:reset"}],"quickstart":{"code":"// First, install ember-try in your Ember CLI project:\nember install ember-try\n\n// This will typically create or update 'config/ember-try.js'.\n// Modify 'config/ember-try.js' to define your testing scenarios:\nmodule.exports = function(/* app */) {\n  return {\n    useVersionCompatibility: true, // Auto-generate scenarios from package.json if desired\n    scenarios: [\n      {\n        name: 'ember-default',\n        npm: {\n          devDependencies: {} // Uses dependencies defined in your project's package.json\n        }\n      },\n      {\n        name: 'ember-release',\n        npm: {\n          devDependencies: {\n            'ember-source': 'release' // Test against the latest stable Ember release\n          }\n        }\n      },\n      {\n        name: 'ember-beta',\n        npm: {\n          devDependencies: {\n            'ember-source': 'beta' // Test against the Ember beta channel\n          }\n        },\n        allowedToFail: true // Beta/Canary scenarios can be configured to fail without blocking CI\n      },\n      {\n        name: 'ember-canary',\n        npm: {\n          devDependencies: {\n            'ember-source': 'canary' // Test against the Ember canary channel\n          }\n        },\n        allowedToFail: true\n      }\n    ]\n  };\n};\n\n// Then, run the `ember try:each` command to execute tests for all scenarios:\nember try:each","lang":"javascript","description":"This quickstart demonstrates how to install `ember-try`, configure a `config/ember-try.js` file with basic scenarios for different Ember versions (default, release, beta, canary), and then execute tests across all defined scenarios using the `ember try:each` command. This setup is common for CI environments."},"warnings":[{"fix":"Update your `config/ember-try.js` file to remove the `project` argument from the exported function signature (e.g., `module.exports = function() { ... }`).","message":"The `ember-cli project` instance is no longer passed as an argument to the configuration function exported by `config/ember-try.js`.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"If your scenarios rely on specific pnpm lifecycle scripts, you may need to explicitly configure them not to be ignored or adjust your workflow accordingly.","message":"When using pnpm, scripts are ignored by default in scenarios to prevent unintended side effects.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Ensure your development and CI environments are running Node.js version 18 or higher. The `engines.node` field specifies `>= 18`.","message":"Node.js 14 support has been dropped.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Migrate all dependency management in your `ember-try` scenarios from Bower to npm or pnpm. `ember-try` now exclusively manages Node package manager dependencies.","message":"Support for scenarios involving Bower dependencies has been dropped.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Always manually run `ember try:reset` after using `--skip-cleanup=true` if you need to restore your project to its original state. Avoid this option before building or deploying if you expect original dependencies.","message":"Using the `--skip-cleanup=true` option with `ember try:one` or `ember try:each` can leave your project in a modified state with the last tested dependencies installed.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-21T00:00:00.000Z","next_check":"2026-07-20T00:00:00.000Z","problems":[{"fix":"Update `config/ember-try.js` to remove the `project` argument from the exported function signature. For example, change `module.exports = function(project) { ... }` to `module.exports = function() { ... }`.","cause":"The `project` instance is no longer passed to the `ember-try` config function in v4.0.0, leading to errors if you attempt to access properties of a non-existent `project` argument.","error":"TypeError: Cannot read properties of undefined (reading 'ui')"},{"fix":"Upgrade your Node.js environment to version 18 or higher (e.g., using `nvm install 18 && nvm use 18`).","cause":"Attempting to run `ember-try` v3.0.0 or higher with an unsupported Node.js version (e.g., Node.js 14).","error":"Error: Node.js v14.x is no longer supported by ember-try. Please upgrade to Node.js v18.x or higher."},{"fix":"Migrate all dependency declarations within your `ember-try` scenarios from Bower to npm or pnpm. `ember-try` exclusively manages Node package manager dependencies.","cause":"Your `ember-try` configuration attempts to define scenarios with Bower dependencies after `ember-try` v2.0.0, which removed Bower support.","error":"Bower is not supported for scenarios. Please use npm or pnpm."},{"fix":"Ensure `ember try:reset` is explicitly run after any command using `--skip-cleanup=true`, or configure your CI to always perform a clean checkout for build steps to prevent dependency pollution.","cause":"A previous `ember try:one` or `ember try:each` command was run with `--skip-cleanup=true`, and the CI environment was not reset before a build step.","error":"My application builds with unexpected dependencies in CI after `ember try:each`."}],"ecosystem":"npm"}