Gathering detailed insights and metrics for ember-qunit
Gathering detailed insights and metrics for ember-qunit
Gathering detailed insights and metrics for ember-qunit
Gathering detailed insights and metrics for ember-qunit
ember-cli-qunit
QUnit testing package for ember-cli applications
ember-sinon-qunit
Sinon sandbox test integration for QUnit
@types/ember-qunit
Stub TypeScript definitions entry for ember-qunit, which provides its own types definitions
ember-qunit-nice-errors
Because expected true, result false is not enough!
npm install ember-qunit
Typescript
Module System
Node Version
NPM Version
JavaScript (76.26%)
TypeScript (15.88%)
HTML (5.51%)
CSS (2.31%)
Handlebars (0.03%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
NOASSERTION License
259 Stars
1,647 Commits
156 Forks
19 Watchers
16 Branches
84 Contributors
Updated on May 13, 2025
Latest Version
9.0.3
Package Id
ember-qunit@9.0.3
Unpacked Size
61.34 kB
Size
17.01 kB
File Count
18
NPM Version
10.8.2
Node Version
18.20.8
Published on
May 13, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
2
21
ember-qunit simplifies testing of Ember applications with QUnit by providing QUnit-specific wrappers around the helpers contained in ember-test-helpers.
If you need support for Node 14 please use v6.2 of this addon.
If you need support for Node 13 or older Ember CLI versions please use v4.x of this addon.
ember-qunit
is an Ember CLI addon, so install it
as you would any other addon:
1$ ember install ember-qunit
Some other addons are detecting the test framework based on the installed
addon names and are expecting ember-cli-qunit
instead. If you have issues
with this then ember install ember-cli-qunit
, which should work exactly
the same.
For instructions how to upgrade to the latest version, please read our Migration Guide.
The following section describes the use of ember-qunit with the latest modern Ember testing APIs, as laid out in the RFCs 232 and 268.
For the older APIs have a look at our Legacy Guide.
Your tests/test-helper.js
file should look similar to the following, to
correctly setup the application required by @ember/test-helpers
:
1import Application from '../app'; 2import config from '../config/environment'; 3import { setApplication } from '@ember/test-helpers'; 4import { start } from 'ember-qunit'; 5 6setApplication(Application.create(config.APP)); 7 8start();
Also make sure that you have set ENV.APP.autoboot = false;
for the test
environment in your config/environment.js
.
In environments that use the AMD Loader, loadTests()
will need to be called
before start()
.
1import Application from '../app'; 2import config from '../config/environment'; 3import { setApplication } from '@ember/test-helpers'; 4import { start } from 'ember-qunit'; 5import { loadTests } from 'ember-qunit/test-loader'; 6 7setApplication(Application.create(config.APP)); 8 9loadTests() 10start();
In ESM environments, this isn't needed as import.meta.glob can load test files.
The setupTest()
function can be used to setup a unit test for any kind
of "module/unit" of your application that can be looked up in a container.
It will setup your test context with:
this.owner
to interact with Ember's Dependency Injection
systemthis.set()
, this.setProperties()
, this.get()
, and this.getProperties()
this.pauseTest()
method to allow easy pausing/resuming of testsFor example, the following is a unit test for the SidebarController
:
1import { module, test } from 'qunit'; 2import { setupTest } from 'ember-qunit'; 3 4module('SidebarController', function(hooks) { 5 setupTest(hooks); 6 7 // Replace this with your real tests. 8 test('exists', function() { 9 let controller = this.owner.lookup('controller:sidebar'); 10 assert.ok(controller); 11 }); 12});
The setupRenderingTest()
function is specifically designed for tests that
render arbitrary templates, including components and helpers.
It will setup your test context the same way as setupTest()
, and additionally:
render()
@ember/test-helpers
(click()
, fillIn()
, ...)1import { module, test } from 'qunit'; 2import { setupRenderingTest } from 'ember-qunit'; 3import { render, find } from '@ember/test-helpers'; 4import { hbs } from 'ember-cli-htmlbars'; 5 6module('GravatarImageComponent', function(hooks) { 7 setupRenderingTest(hooks); 8 9 test('renders', async function() { 10 await render(hbs`{{gravatar-image}}`); 11 assert.ok(find('img')); 12 }); 13});
The setupApplicationTest()
function can be used to run tests that interact
with the whole application, so in most cases acceptance tests.
On top of setupTest()
it will:
click()
, fillIn()
, ...) as well as the Routing Helpers
(visit()
, currentURL()
, ...) from @ember/test-helpers
1import { module, test } from 'qunit'; 2import { setupApplicationTest } from 'ember-qunit'; 3import { visit, currentURL } from '@ember/test-helpers'; 4 5module('basic acceptance test', function(hooks) { 6 setupApplicationTest(hooks); 7 8 test('can visit /', async function(assert) { 9 await visit('/'); 10 assert.equal(currentURL(), '/'); 11 }); 12});
Configuration is optionally managed via @embroider/macros
To configure ember-qunit
, in your ember-cli-build.js
, add:
1'use strict';
2
3const EmberApp = require('ember-cli/lib/broccoli/ember-app');
4
5module.exports = function (defaults) {
6 const app = new EmberApp(defaults, {
7 '@embroider/macros': {
8 setConfig: {
9 'ember-qunit': {
10 /**
11 * default: false
12 *
13 * removes the CSS for the test-container (where the app and components are rendered to)
14 */
15 disableContainerStyles: true,
16 /**
17 * default: 'qunit-default'
18 * options: 'qunit-default' | 'ember'
19 *
20 * Sets the theme for the Web UI of the test runner. Use a different value to disable loading any theme, allowing you to provide your own external one.
21 */
22 theme: 'qunit-default',
23 },
24 },
25 },
26 /* ... */
27 });
28
29 /* ... */
30};
git clone <repository-url>
cd ember-qunit
pnpm install
pnpm test
(Runs ember try:each
to test your addon against multiple Ember versions)ember test
ember test --server
ember serve
For more information on using ember-cli, visit https://ember-cli.com/.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
packaging workflow detected
Details
Reason
license file detected
Details
Reason
Found 6/8 approved changesets -- score normalized to 7
Reason
6 existing vulnerabilities detected
Details
Reason
4 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 3
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More