or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

commands.mdconfiguration.mddependency-management.mdindex.mdtask-execution.mdutilities.md
tile.json

tessl/npm-ember-try

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

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/ember-try@4.0.x

To install, run

npx @tessl/cli install tessl/npm-ember-try@4.0.0

index.mddocs/

ember-try

ember-try is an Ember CLI addon that enables testing Ember applications and addons against multiple dependency versions, particularly ember and ember-data. It provides comprehensive commands for running tests across different scenarios, automatic configuration generation from semver constraints, and seamless integration with various package managers.

Package Information

  • Package Name: ember-try
  • Package Type: npm
  • Language: JavaScript
  • Installation: ember install ember-try

Core Imports

ember-try is an Ember CLI addon and doesn't provide programmatic imports. Instead, it integrates with ember-cli and provides commands.

Basic Usage

# Test against all configured scenarios
ember try:each

# Test against a specific scenario
ember try:one ember-lts-3.16 --- ember test

# Test against ember versions matching a semver range
ember try:ember ">=3.16.0 <4.0.0"

# Display current configuration
ember try:config

# Reset dependencies after testing
ember try:reset

Architecture

ember-try is built around several key components:

  • Command System: Five main commands (try:each, try:one, try:ember, try:config, try:reset) integrated with ember-cli
  • Task Execution: Core task classes (TryEachTask, ResetTask) that handle scenario execution and cleanup
  • Scenario Management: Configuration-driven testing scenarios with dependency specifications
  • Dependency Adapters: Package manager abstraction supporting npm, yarn, pnpm, and workspace configurations
  • Configuration Engine: Automatic scenario generation from semver compatibility declarations

Capabilities

Commands

Core ember-cli commands for running tests across multiple dependency scenarios.

// Available commands (accessed via ember-cli)
'try:each'   // Run tests for all scenarios
'try:one'    // Run tests for specific scenario  
'try:ember'  // Run tests for ember versions matching semver
'try:config' // Display configuration
'try:reset'  // Reset dependencies

Commands

Configuration

Configuration system for defining test scenarios and package manager settings.

// Configuration file structure (config/ember-try.js)
interface EmberTryConfig {
  command?: string;                    // Default test command
  npmOptions?: string[];               // Options passed to package manager
  useVersionCompatibility?: boolean;   // Use package.json versionCompatibility
  packageManager?: 'npm' | 'pnpm' | 'yarn'; // Package manager to use
  buildManagerOptions?: (scenario: Scenario) => string[]; // Custom package manager options
  scenarios: Scenario[];               // Test scenarios
}

interface Scenario {
  name: string;                        // Scenario name
  npm?: {                              // npm dependencies
    devDependencies?: Record<string, string>;
    dependencies?: Record<string, string>;
    overrides?: Record<string, string>;
    resolutions?: Record<string, string>;
    ember?: Record<string, any>;
  };
  env?: Record<string, string>;        // Environment variables
  allowedToFail?: boolean;            // Allow scenario to fail without failing build
  command?: string;                   // Custom command for this scenario
}

Configuration

Task Execution

Core task classes that handle scenario execution, dependency management, and cleanup.

class TryEachTask {
  constructor(options: {
    config: EmberTryConfig;
    cwd: string;
    commandArgs?: string[];
    commandOptions?: any;
    dependencyManagerAdapters?: DependencyManagerAdapter[];
  });
  
  run(scenarios: Scenario[], options?: { skipCleanup?: boolean }): Promise<number>;
}

class ResetTask {
  constructor(options: { config: EmberTryConfig; cwd: string });
  
  run(): Promise<void>;
}

Task Execution

Dependency Management

Dependency manager adapters for handling package installations across different package managers.

interface DependencyManagerAdapter {
  configKey: string;                   // Configuration key (e.g., 'npm')
  setup(): Promise<void>;              // Setup adapter
  changeToDependencySet(dependencies: any): Promise<any[]>; // Change dependencies
  cleanup(): Promise<void>;            // Cleanup and restore
}

class ScenarioManager {
  constructor(options: { dependencyManagerAdapters: DependencyManagerAdapter[] });
  
  setup(): Promise<void>;
  changeTo(scenario: Scenario): Promise<any[]>;
  cleanup(): Promise<void>;
}

Dependency Management

Utilities

Utility functions for configuration, command execution, console output, and result reporting.

// Configuration utilities
function getConfig(options: {
  configPath?: string;
  cwd: string;
  versionCompatibility?: Record<string, string>;
}): Promise<EmberTryConfig>;

// Console utilities
function log(message: string): void;
function info(message: string): void;
function error(message: string): void;
function warn(message: string): void;
function success(message: string): void;

// Command execution
function runCommand(
  root: string,
  commandArgs: string[],
  opts?: any
): Promise<boolean>;

// Result reporting
class ResultSummary {
  constructor(options: { results: any[] });
  print(): void;
}

Utilities

Types

interface EmberTryConfig {
  command?: string;
  npmOptions?: string[];
  useVersionCompatibility?: boolean;
  packageManager?: 'npm' | 'pnpm' | 'yarn';
  buildManagerOptions?: (scenario: Scenario) => string[];
  scenarios: Scenario[];
}

interface Scenario {
  name: string;
  npm?: {
    devDependencies?: Record<string, string>;
    dependencies?: Record<string, string>;
    overrides?: Record<string, string>;
    resolutions?: Record<string, string>;
    ember?: Record<string, any>;
  };
  env?: Record<string, string>;
  allowedToFail?: boolean;
  command?: string;
}

interface DependencyManagerAdapter {
  configKey: string;
  setup(): Promise<void>;
  changeToDependencySet(dependencies: any): Promise<any[]>;
  cleanup(): Promise<void>;
}