CARVIEW |
Select Language
HTTP/2 200
server: GitHub.com
content-type: text/html; charset=utf-8
last-modified: Mon, 29 Jul 2024 17:43:22 GMT
access-control-allow-origin: *
etag: W/"66a7d4ba-2abb"
expires: Fri, 10 Oct 2025 17:06:19 GMT
cache-control: max-age=600
content-encoding: gzip
x-proxy-cache: MISS
x-github-request-id: 644B:C0BFA:1B27CE:1FF0FA:68E93AB3
accept-ranges: bytes
age: 0
date: Fri, 10 Oct 2025 16:56:20 GMT
via: 1.1 varnish
x-served-by: cache-bom-vanm7210037-BOM
x-cache: MISS
x-cache-hits: 0
x-timer: S1760115380.722169,VS0,VE292
vary: Accept-Encoding
x-fastly-request-id: 27e887e44f1888473d643cd8add74280ff1a2a59
content-length: 2924
Karma - Ember.js
Heads Up! You're viewing the docs for v0.10, an old version of Karma.
v6.4 is the newest.
Ember.js
To execute javascript unit and integration tests with ember.js follow the steps below:
install the qunit plugin
npm install karma-qunit --save-dev
install the ember preprocessor plugin
npm install karma-ember-preprocessor --save-dev
generate a configuration file for karma
karma init
note -the above will walk you through the basic setup. An example configuration file that works with ember.js/qunit and phantomjs is below
module.exports = function(config) { config.set({ basePath: 'js', files: [ 'vendor/jquery/jquery.min.js', 'vendor/handlebars/handlebars.js', 'vendor/ember/ember.js', 'app.js', 'tests/*.js', 'templates/*.handlebars' ], browsers: ['PhantomJS'], singleRun: true, autoWatch: false, frameworks: ['qunit'], plugins: [ 'karma-qunit', 'karma-ember-preprocessor', 'karma-phantomjs-launcher' ], preprocessors: { '**/*.handlebars': 'ember' } }); };
Note - the
files
section above should include all dependencies, ie- jQuery/handlebars/ember.js along with the js and handlebars files required to deploy and run your production ember.js applicationadd a simple qunit test
test('one should equal one', function() { equal(1, 1, 'error: one did not equal one'); });
run the tests with karma from the command line
karma start
A simple unit / integration tested example app showing karma / qunit / ember in action can be found here