2.0.0 • Published 5 years ago

mammoth-test-helpers v2.0.0

Weekly downloads
4
License
MIT
Repository
github
Last release
5 years ago

Build Status

mammoth-test-helpers

A set of QUnit extensions, stubs for common global tools, and other testing tools for testing Ember CLI applications.

Installation

  • ember install mammoth-test-helpers

Use

The primary way to use this is to add some code to your tests/test-helper.js. You include the primary prepTests helper, and can programatically add additional helpers to load.

For example:

import resolver                  from './helpers/resolver';
import prepTests, { addToQueue } from 'mammoth-test-helpers/test-support/prep-tests';
import linkTo                    from 'mammoth-test-helpers/test-support/helpers/link-to-helper';
import googleChart               from 'mammoth-test-helpers/test-support/stubs/google-chart';
import stripe                    from 'mammoth-test-helpers/test-support/stubs/stripe';
import wysihtml5                 from 'mammoth-test-helpers/test-support/stubs/wysihtml5';
import { setResolver }           from '@ember/test-helpers';

setResolver(resolver);

// Add some non-default helpers
addToQueue(linkTo);
addToQueue(googleChart);
addToQueue(stripe);
addToQueue(wysihtml5);

// Load queued helpers
prepTests();

(This example loads everything!)

Modules

Several modules are includes:

PathDefault?DescriptionSource
mammoth-test-helpers/test-support/helpers/assert-helpersYesAdds numerous helpers to QUnit's assert.source
mammoth-test-helpers/test-support/helpers/link-to-helperAdds data attributes to link-to helpers that track the passed in models / path.source
mammoth-test-helpers/test-support/helpers/ajaxA couple of simple helpers for simplifying ajax requests (e.g. using Pretender.js).source
mammoth-test-helpers/test-support/helpers/jquery-actionsWrappers around ember-test-helper tools so that you can pass jQuery selectorssource
mammoth-test-helpers/test-support/helpers/select-a-selectA simple helper for firing a change action on a select.source
mammoth-test-helpers/test-support/shims/consoleShim for window.console.log if it doesn't exist (thanks IE!).source
mammoth-test-helpers/test-support/stubs/google-chartStub out common methods related to google charts.source
mammoth-test-helpers/test-support/stubs/stripeStub out some common behavior for Stripe.source
mammoth-test-helpers/test-support/stubs/ember-tooltipsStub out components from ember-tooltips for unit tests.source
mammoth-test-helpers/test-support/stubs/wysihtml5Stub out globals for WysiHTML5.source
mammoth-test-helpers/test-support/temporary-stubs/rsvpReturns stubRSVP and unstubRSVP for situations where you don't want RSVP to throw an error (e.g. if you are testing failed requests).source
mammoth-test-helpers/test-support/temporary-stubs/window-actionsIncludes several methods for stubbing / unstubbing common blocking window actions (e.g. alert and confirm.) Stubs accept functions for testing parameters.source

Test Reporter

Included is a custom test reporter for Testem that results in simple output (dots) with failure summaries at the end. This is ideal in a CI environment.

To use, add this to your testem.js file:

const Reporter = require('./node_modules/mammoth-test-helpers/test-reporter');

module.exports = {
  reporter: Reporter,
...

Running Tests

  • npm test (Runs ember try:each to test your addon against multiple Ember versions)
  • ember test
  • ember test --server

Building

  • ember build

For more information on using ember-cli, visit https://ember-cli.com/.

2.0.0

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago

0.15.0

5 years ago

0.14.0

5 years ago

0.13.0

6 years ago

0.12.0

6 years ago

0.11.0

6 years ago

0.10.1

6 years ago

0.10.0

6 years ago

0.9.0

6 years ago

0.8.1

6 years ago

0.8.0

6 years ago

0.7.2

6 years ago

0.7.1

6 years ago

0.7.0

6 years ago

0.6.0

7 years ago

0.5.1

7 years ago

0.5.0

7 years ago

0.4.0

7 years ago

0.3.0

7 years ago

0.2.2

7 years ago

0.2.1

7 years ago