Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ember-test-helpers

Package Overview
Dependencies
Maintainers
4
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ember-test-helpers

Helpers for testing Ember.js applications

  • 0.5.27
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.7K
decreased by-43.66%
Maintainers
4
Weekly downloads
 
Created
Source

ember-test-helpers Build Status

A test-framework-agnostic set of helpers for testing Ember.js applications.

Usage

This library is best used in conjunction with a test-framework-specific wrapper, such as ember-qunit or ember-mocha.

This library was written using ES6 modules, which are contained in lib/. These modules must be transpiled for pre-ES6 compatibility.

Test Helpers

TestModule

The TestModule class is used to configure modules for unit testing different aspects of your Ember application. This class can be extended to create modules focused on particular types of unit tests.

TestModule is intended to be used in conjunction with modules specific to a test framework. For instance, you could create QUnit-compatible modules with a method such as:

function moduleFor(name, description, callbacks) {
  var module = new TestModule(name, description, callbacks);

  QUnit.module(module.name, {
    setup: function() {
      module.setup();
    },
    teardown: function() {
      module.teardown();
    }
  });
}

TestModule(name [, description [, callbacks]])

  • name - the full name of the test subject as it is registered in a container (e.g. 'controller:application', 'route:index', etc.).

  • description (optional) - the description of the test module as it should be displayed in test output. If omitted, defaults to name.

  • callbacks (optional) - an object that may include setup and teardown steps as well as the other units needed by tests.

TestModuleForComponent

TestModuleForComponent extends TestModule to allow unit testing of Ember Components.


TestModuleForComponent(name [, description [, callbacks]])

  • name - the short name of the component that you'd use in a template (e.g. 'x-foo', 'color-picker', etc.).

TestModuleForModel

TestModuleForModel extends TestModule to allow unit testing of Ember Data Models.


TestModuleForModel(name [, description [, callbacks]])

  • name - the short name of the model that you'd use in store operations (e.g. 'user', 'assignmentGroup', etc.).

Miscellaneous Helpers

  • getContext / setContext - access the context to be used in each test.

  • setResolver - sets the resolver which will be used to look up objects from each test's container.

  • isolatedContainer - creates a new isolated container for unit testing.

Contributing

Contributions are welcome. Please follow the instructions below to install and test this library.

Installation

$ npm install
$ bower install

Testing

In order to test in the browser:

$ npm start

... and then visit http://localhost:4200/tests.

In order to perform a CI test:

$ npm test

Attribution

Much of ember-test-helpers was extracted from the original ember-qunit, which was written by Stefan Penner, Robert Jackson, and Ryan Florence.

Copyright 2015 Switchfly and contributors.

Dual-licensed under the Apache License, Version 2.0 and the MIT License.

FAQs

Package last updated on 20 Jun 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc