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

ember-qunit

Package Overview
Dependencies
Maintainers
2
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ember-qunit - npm Package Compare versions

Comparing version 0.1.8 to 0.2.0

.ember-cli

43

package.json
{
"name": "ember-qunit",
"version": "0.1.8",
"description": "unit test helpers for ember",
"main": "dist/cjs/main.js",
"version": "0.2.0",
"description": "QUnit helpers for testing Ember.js applications",
"main": "lib/ember-qunit.js",
"scripts": {
"test": "bower install && rm -rf dist && broccoli build dist && karma start --browsers Firefox --single-run"
"build": "ember build",
"prepublish": "bower install",
"pretest": "ember build",
"test": "testem ci",
"start": "ember serve"
},
"authors": [
"Stefan Penner",
"Ryan Florence"
"Ryan Florence",
"Robert Jackson",
"Dan Gebhardt"
],
"license": "MIT",
"devDependencies": {
"broccoli": "~0.2.0",
"broccoli-dist-es6-module": "^0.1.8",
"karma-script-launcher": "~0.1.0",
"karma-chrome-launcher": "~0.1.2",
"karma-firefox-launcher": "~0.1.3",
"karma-html2js-preprocessor": "~0.1.0",
"karma-jasmine": "~0.1.5",
"karma-coffee-preprocessor": "~0.1.3",
"requirejs": "~2.1.11",
"karma-requirejs": "~0.2.1",
"karma-phantomjs-launcher": "~0.1.2",
"karma": "~0.10.9",
"qunitjs": "~1.12.0",
"karma-qunit": "~0.1.1",
"bower": "^1.2.8",
"broccoli-cli": "0.0.1"
"bower": "^1.3.12",
"broccoli": "^0.13.0",
"broccoli-es6modules": "^0.4.0",
"broccoli-funnel": "^0.1.6",
"broccoli-jshint": "^0.5.3",
"broccoli-merge-trees": "^0.1.4",
"broccoli-sourcemap-concat": "^0.4.3",
"broccoli-string-replace": "0.0.2",
"ember-cli": "^0.1.12",
"git-repo-info": "^1.0.2",
"testem": "0.6.22"
}
}

@@ -1,33 +0,13 @@

Ember QUnit
===========
# Ember QUnit [![Build Status](https://travis-ci.org/rwjblue/ember-qunit.png)](https://travis-ci.org/rwjblue/ember-qunit)
[![Build Status](https://travis-ci.org/rpflorence/ember-qunit.png)](https://travis-ci.org/rpflorence/ember-qunit)
**IMPORTANT NOTE** - The build process is currently changing for this project. In v0.1.8 and below, builds were pushed to a `dist/` dir. Going forward, we're going to push builds to a separate repo: [ember-qunit-builds](https://github.com/rwjblue/ember-qunit-builds). Until this transition is complete, please update your bower.json if it's referencing `rwjblue/ember-qunit#master`. Instead specify a version (`rwjblue/ember-qunit#v0.1.8`) or SHA (f3f852789bc80486afae1a9ddb7810356050fe9b or older).
[WIP] Unit test helpers for Ember.
-------
About
-----
Ember QUnit simplifies unit testing of Ember applications with QUnit by
providing QUnit-specific wrappers around the helpers contained in
[ember-test-helpers](https://github.com/switchfly/ember-test-helpers).
Ember QUnit uses your application's resolver to find and automatically
create test subjects for you with the `moduleFor` and `test` helpers.
## Usage
*This is a work in progress* but its also quite handy already. Feedback
is highly encouraged.
Module Formats
--------------
You will find all the popular formats in `dist/`. If using globals, all
methods are found on `window.emq`.
Examples
--------
### Global build setup:
```js
// inject test helpers onto window
emq.globalize();
```
### Setting the resolver

@@ -60,4 +40,4 @@

// appends the component to the page
this.append();
// render the component on the page
this.render();
equal(component.state, 'inDOM');

@@ -83,3 +63,3 @@ });

expect(3);
var component = test.subject({
var component = this.subject({

@@ -99,3 +79,3 @@ // can provide properties for the subject, like the yielded template

});
this.append();
this.render();
var tab1 = Ember.View.views['tab1'];

@@ -109,6 +89,60 @@ var panel1 = Ember.View.views['panel1'];

```
If you are using nested components with templates, you have to list them separately - otherwise your templates won't be loaded:
```js
moduleForComponent('ic-tabs', 'TabsComponent', {
Helpers
-------
// specify the other units and templates that are required for this test
needs: [
'component:ic-tab',
'template:components/ic-tab',
'component:ic-tab-panel',
'template:components/ic-tab-panel',
'component:ic-tab-list'
]
});
.....
```
### Async Example
Under the hood, if you use `Ember.RSVP.Promise`, ember-qunit will call
QUnit's `start` and `stop` helpers to stop the test from tearing down
and running other tests while your asynchronous code runs. ember-qunit
also asserts that the promise gets fulfilled.
In addition, you can also return promises in the test body:
```js
// If you return a promise from a test callback it becomes an asyncTest. This
// is a key difference between ember-qunit and standard QUnit.
test('async is awesome', function() {
expect(1);
var myThing = MyThing.create();
// myThing.exampleMethod() returns a promise
return myThing.exampleMethod().then(function() {
ok(myThing.get('finished'));
});
});
```
If an error is thrown in your promise or a promise
within `test` becomes rejected, ember-qunit will fail the test.
To assert that a promise should be rejected, you can "catch"
the error and assert that you got there:
```js
test('sometimes async gets rejected', function(){
expect(1);
var myThing = MyThing.create()
return myThing.exampleMethod().then(function(){
ok(false, "promise should not be fulfilled");
})['catch'](function(err){
equal(err.message, "User not Authorized");
});
});
```
## Test Helpers
### `moduleFor(fullName [, description [, callbacks]])`

@@ -135,13 +169,31 @@

Contributing
------------
## Contributing
Contributions are welcome. Please follow the instructions below to install and
test this library.
### Installation
```sh
$ npm install
$ bower install
$ npm install -g karma-cli broccoli-cli
$ broccoli serve
# new tab
$ karma start
```
### Testing
In order to test in the browser:
```sh
$ npm start
```
... and then visit [http://localhost:4200/tests](http://localhost:4200/tests).
In order to perform a CI test:
```sh
$ npm test
```
## Copyright and License
Copyright 2014 Ryan Florence and contributors. [MIT License](./LICENSE).

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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