# Testing

**URL:** https://discuss.emberjs.com/c/testing/7.md

[Latest](https://discuss.emberjs.com/latest.md) · [Categories](https://discuss.emberjs.com/categories.md)

---

## [About the Testing category](https://discuss.emberjs.com/t/about-the-testing-category/16648)

<div class="topic-metadata">

**Author:** [@eviltrout](https://discuss.emberjs.com/u/eviltrout)\
**Replies:** 0

</div>

(Replace this first paragraph with a brief description of your new category. This guidance will appear in the category selection area, so try to keep it below 200 characters.) Use the following paragraphs for a longer d…

---

## [Testing interim states with the latest test-helpers](https://discuss.emberjs.com/t/testing-interim-states-with-the-latest-test-helpers/15117)

<div class="topic-metadata">

**Author:** [@jgwhite](https://discuss.emberjs.com/u/jgwhite)\
**Replies:** 7\
**Last updated:** [March 25, 2025, 3:04pm UTC](https://discuss.emberjs.com/t/testing-interim-states-with-the-latest-test-helpers/15117 "2025-03-25T15:04:22Z")

</div>

I’m sure it used to be possible to do something like this: let promise = fillIn('.some-field', 'Some value'); assert.ok(someInterimState); await promise; // ... But all the helpers in @ember/test-helpers appear to b…

---

## [Ember-mocha still supported in Ember v4?](https://discuss.emberjs.com/t/ember-mocha-still-supported-in-ember-v4/19967)

<div class="topic-metadata">

**Author:** [@dbader](https://discuss.emberjs.com/u/dbader)\
**Replies:** 4\
**Last updated:** [October 24, 2024, 8:24pm UTC](https://discuss.emberjs.com/t/ember-mocha-still-supported-in-ember-v4/19967 "2024-10-24T20:24:08Z")

</div>

I’m in the process of upgrading an app from Ember v3.28 to v4.4 and running into some issues w/ the test setup. I’m wondering if perhaps Ember-mocha is no longer supported? I noticed in the Ember docs (Introduction - Tes…

---

## [Incorrect peer dependencies issue](https://discuss.emberjs.com/t/incorrect-peer-dependencies-issue/20577)

<div class="topic-metadata">

**Author:** [@thenram](https://discuss.emberjs.com/u/thenram)\
**Replies:** 0\
**Last updated:** [July 18, 2024, 12:40pm UTC](https://discuss.emberjs.com/t/incorrect-peer-dependencies-issue/20577 "2024-07-18T12:40:51Z")

</div>

Some V1 ember addons are resolving as incorrect peer dependencies. This makes it impossible for us to safely convert them to v2 format. :point\_down: :point\_down: :point\_down: :point\_right: See embroider/docs/peer-depend…

---

## [Content Security Policy and Ember Test](https://discuss.emberjs.com/t/content-security-policy-and-ember-test/20568)

<div class="topic-metadata">

**Author:** [@b-rlw](https://discuss.emberjs.com/u/b-rlw)\
**Replies:** 5\
**Last updated:** [July 18, 2024, 2:56pm UTC](https://discuss.emberjs.com/t/content-security-policy-and-ember-test/20568 "2024-07-18T14:56:30Z")

</div>

I have recently added a Content Security Policy to my project. It’s pretty well locked down, and the application works as expected. I had to clean up several direct style=‘’ uses and add a trio of sha hashes to allow a f…

---

## [Help with ember-cli-mirage not loading routes](https://discuss.emberjs.com/t/help-with-ember-cli-mirage-not-loading-routes/20536)

<div class="topic-metadata">

**Author:** [@mhelwig](https://discuss.emberjs.com/u/mhelwig)\
**Replies:** 0\
**Last updated:** [June 14, 2024, 8:33pm UTC](https://discuss.emberjs.com/t/help-with-ember-cli-mirage-not-loading-routes/20536 "2024-06-14T20:33:08Z")

</div>

After upgrading my application, ember-cli-mirage doesn’t seem to use mirage/config as a part of the setup. As a result, routes are not defined as a part of the server.\_config & none of the existing Acceptance tests are …

---

## [Simulating pressing Enter on a button in a test](https://discuss.emberjs.com/t/simulating-pressing-enter-on-a-button-in-a-test/20415)

<div class="topic-metadata">

**Author:** [@skaterdav85](https://discuss.emberjs.com/u/skaterdav85)\
**Replies:** 4\
**Last updated:** [February 10, 2024, 11:24am UTC](https://discuss.emberjs.com/t/simulating-pressing-enter-on-a-button-in-a-test/20415 "2024-02-10T11:24:43Z")

</div>

I have a component with a button and a click handler. In my test, I’m trying to simulate pressing Enter on the button, but it won’t fire the click handler. However when I manually do it, it does. Any ideas? ember g comp…

---

## [Error running tests](https://discuss.emberjs.com/t/error-running-tests/17560)

<div class="topic-metadata">

**Author:** [@cgallo](https://discuss.emberjs.com/u/cgallo)\
**Replies:** 2\
**Last updated:** [September 28, 2023, 1:45am UTC](https://discuss.emberjs.com/t/error-running-tests/17560 "2023-09-28T01:45:17Z")

</div>

I am trying to create my first test, but I am getting errors just trying to run the test engine. When I execute “ember test” this is the result. I have not yet added my test. Built project successfully. Stored in “C:\\U…

---

## [Controlling which tests get executed with ember-cli](https://discuss.emberjs.com/t/controlling-which-tests-get-executed-with-ember-cli/6962)

<div class="topic-metadata">

**Author:** [@solsberg](https://discuss.emberjs.com/u/solsberg)\
**Replies:** 5\
**Last updated:** [September 27, 2023, 12:21pm UTC](https://discuss.emberjs.com/t/controlling-which-tests-get-executed-with-ember-cli/6962 "2023-09-27T12:21:39Z")

</div>

I am looking for tips on how to control which tests get run from the ember-cli command line. For example, I sometimes want to run just my unit tests, or perhaps just the tests in a single test file. So is there a way to…

---

## [The value and benefit of assert.expect()](https://discuss.emberjs.com/t/the-value-and-benefit-of-assert-expect/20145)

<div class="topic-metadata">

**Author:** [@Krinkle](https://discuss.emberjs.com/u/Krinkle)\
**Replies:** 5\
**Last updated:** [August 1, 2023, 10:03am UTC](https://discuss.emberjs.com/t/the-value-and-benefit-of-assert-expect/20145 "2023-08-01T10:03:01Z")

</div>

Hi! I’m Timo Tijhof, the project lead for upstream QUnit. First off, I’d like to say thank you for many years of useful and kind upstream feedback, bug reports, and pull requests. I’d like to hear from you in the Embe…

---

## [Test order and good TDD](https://discuss.emberjs.com/t/test-order-and-good-tdd/20044)

<div class="topic-metadata">

**Author:** [@sukima](https://discuss.emberjs.com/u/sukima)\
**Replies:** 1\
**Last updated:** [April 24, 2023, 12:07pm UTC](https://discuss.emberjs.com/t/test-order-and-good-tdd/20044 "2023-04-24T12:07:15Z")

</div>

After some research into testing specifically unit/integration tests versus acceptance tests. And the order of execution. According to Jan Van Ryswyck who refers to these two types as solitary tests and socially tests (r…

---

## [How to using and restricting it to trigger on one file? i.e ember.testing while doing onerror call?](https://discuss.emberjs.com/t/how-to-using-and-restricting-it-to-trigger-on-one-file-i-e-ember-testing-while-doing-onerror-call/19875)

<div class="topic-metadata">

**Author:** [@sandeep49m](https://discuss.emberjs.com/u/sandeep49m)\
**Replies:** 2\
**Last updated:** [January 10, 2023, 12:09pm UTC](https://discuss.emberjs.com/t/how-to-using-and-restricting-it-to-trigger-on-one-file-i-e-ember-testing-while-doing-onerror-call/19875 "2023-01-10T12:09:46Z")

</div>

I have implemented onerror call in my app.js file and inside it I am checking the ‘if’ condition for ‘ember.testing’ in route: let onerror = function() { if (ember.testing) { throw error; } but there is same condition …

---

## [Improve test speed with ember exam and github actions](https://discuss.emberjs.com/t/improve-test-speed-with-ember-exam-and-github-actions/19828)

<div class="topic-metadata">

**Author:** [@fluxsaas](https://discuss.emberjs.com/u/fluxsaas)\
**Replies:** 4\
**Last updated:** [December 9, 2022, 10:24pm UTC](https://discuss.emberjs.com/t/improve-test-speed-with-ember-exam-and-github-actions/19828 "2022-12-09T22:24:18Z")

</div>

Hello community! i’m currently testing out ember-exam. i could get the the tests to run faster by splitting them up in multiple browser with: ember exam -s --split=4 --parallel but i would like to get those test paral…

---

## [Help getting ember-cli-mirage working](https://discuss.emberjs.com/t/help-getting-ember-cli-mirage-working/14455)

<div class="topic-metadata">

**Author:** [@mikeburg](https://discuss.emberjs.com/u/mikeburg)\
**Replies:** 8\
**Last updated:** [September 26, 2022, 10:22pm UTC](https://discuss.emberjs.com/t/help-getting-ember-cli-mirage-working/14455 "2022-09-26T22:22:19Z")

</div>

Hi folks, This is my first time working with ember-cli-mirage and I need some help trying to figure out how to get it working. None of the ajax calls, either made by ember-ajax or ember-fetch, are being intercepted and …

---

## [Import static json into test file](https://discuss.emberjs.com/t/import-static-json-into-test-file/17603)

<div class="topic-metadata">

**Author:** [@zapalagrzegorz](https://discuss.emberjs.com/u/zapalagrzegorz)\
**Replies:** 2\
**Last updated:** [July 29, 2022, 5:04am UTC](https://discuss.emberjs.com/t/import-static-json-into-test-file/17603 "2022-07-29T05:04:58Z")

</div>

Hey, Just starting with Ember. Trying to mock some data with prepared JSON. It’s theoretically possible, according to SO to import json into JS with Babel using following syntax: 1. import \* as data from './example.j…

---

## [CI Configuration on new apps](https://discuss.emberjs.com/t/ci-configuration-on-new-apps/19439)

<div class="topic-metadata">

**Author:** [@kenprogrammer](https://discuss.emberjs.com/u/kenprogrammer)\
**Replies:** 2\
**Last updated:** [March 11, 2022, 3:58pm UTC](https://discuss.emberjs.com/t/ci-configuration-on-new-apps/19439 "2022-03-11T15:58:11Z")

</div>

I used the quick start tutorial create the ember quick start app. I decided to upload the app on the GitHub just for future reference. Today I received GitHub notification about failed CI workflow. CI: All jobs have fai…

---

## [To stub or not to stub the router service in integration tests](https://discuss.emberjs.com/t/to-stub-or-not-to-stub-the-router-service-in-integration-tests/16742)

<div class="topic-metadata">

**Author:** [@bartocc](https://discuss.emberjs.com/u/bartocc)\
**Replies:** 15\
**Last updated:** [January 5, 2022, 6:48pm UTC](https://discuss.emberjs.com/t/to-stub-or-not-to-stub-the-router-service-in-integration-tests/16742 "2022-01-05T18:48:19Z")

</div>

Let’s imagine a component uses the router service currentRouteName property to decide what to display in its template. To tests this, I would write an integration test where I would stub the router service and provide i…

---

## [Chrome Ember extension broken (Nov 18)](https://discuss.emberjs.com/t/chrome-ember-extension-broken-nov-18/19289)

<div class="topic-metadata">

**Author:** [@Drallieiv](https://discuss.emberjs.com/u/Drallieiv)\
**Replies:** 3\
**Last updated:** [November 20, 2021, 12:07am UTC](https://discuss.emberjs.com/t/chrome-ember-extension-broken-nov-18/19289 "2021-11-20T00:07:22Z")

</div>

As of this morning Nov 18, The chrome Ember extension shows a completely white frame. Looking at the debug frame for the extension itself, I see a Failed to load resource: net::ERR\_FILE\_NOT\_FOUND chrome-extension://bmd…

---

## [Ember test with async await functions not working as intended](https://discuss.emberjs.com/t/ember-test-with-async-await-functions-not-working-as-intended/18435)

<div class="topic-metadata">

**Author:** [@mArtinko5MB](https://discuss.emberjs.com/u/mArtinko5MB)\
**Replies:** 10\
**Last updated:** [November 17, 2021, 12:34am UTC](https://discuss.emberjs.com/t/ember-test-with-async-await-functions-not-working-as-intended/18435 "2021-11-17T00:34:33Z")

</div>

Can someone explain to me, why the following code won’t wait for asynchronous click function? import { module, test } from 'qunit'; import { click, visit, currentURL, fillIn, pauseTest } from '@ember/test-helpers'; impo…

---

## [Scoped NPM breaks rendering test](https://discuss.emberjs.com/t/scoped-npm-breaks-rendering-test/19226)

<div class="topic-metadata">

**Author:** [@dsaint](https://discuss.emberjs.com/u/dsaint)\
**Replies:** 4\
**Last updated:** [November 2, 2021, 1:02am UTC](https://discuss.emberjs.com/t/scoped-npm-breaks-rendering-test/19226 "2021-11-02T01:02:53Z")

</div>

When I switch the package.json to use a scoped NPM package name it breaks all my qunit rendering tests with the following error: Failed to create an instance of 'component:json-editor' If I edit index.js and change nam…

---

## [Mocks and stubs: sinon vs ember-sinon vs ember-sinon-qunit](https://discuss.emberjs.com/t/mocks-and-stubs-sinon-vs-ember-sinon-vs-ember-sinon-qunit/19114)

<div class="topic-metadata">

**Author:** [@enanone](https://discuss.emberjs.com/u/enanone)\
**Replies:** 2\
**Last updated:** [September 25, 2021, 5:48pm UTC](https://discuss.emberjs.com/t/mocks-and-stubs-sinon-vs-ember-sinon-vs-ember-sinon-qunit/19114 "2021-09-25T17:48:56Z")

</div>

What is the way to go for mocking and stubbing functions in Ember applications as of 2021? Some research has shown these three candidates: Sinon. It is a very well known framework for spies, mocks and stubs. However, …

---

## [how do i stub/mock performance.now() using sinon.js?](https://discuss.emberjs.com/t/how-do-i-stub-mock-performance-now-using-sinon-js/17667)

<div class="topic-metadata">

**Author:** [@kumar\_b](https://discuss.emberjs.com/u/kumar_b)\
**Replies:** 1\
**Last updated:** [September 25, 2021, 5:45pm UTC](https://discuss.emberjs.com/t/how-do-i-stub-mock-performance-now-using-sinon-js/17667 "2021-09-25T17:45:44Z")

</div>

I am writing unit tests in Ember-qunit. I want to set a custom value on performance.now. I tried sinon.stub(performance,'now', 60000); but this didn’t work. I get TypeError: stub(obj, 'meth', fn) has been removed. h…

---

## [Why is the expect (ember-mocha) doesn't run in ember-mirage route?](https://discuss.emberjs.com/t/why-is-the-expect-ember-mocha-doesnt-run-in-ember-mirage-route/19049)

<div class="topic-metadata">

**Author:** [@Daniel\_Fabian](https://discuss.emberjs.com/u/Daniel_Fabian)\
**Replies:** 6\
**Last updated:** [August 7, 2021, 2:26pm UTC](https://discuss.emberjs.com/t/why-is-the-expect-ember-mocha-doesnt-run-in-ember-mirage-route/19049 "2021-08-07T14:26:29Z")

</div>

it('check request \\'by\\' query param', async function() { this.by = 'gender'; this.server.get('/patients/stats', (\_schema: any, request: any) =\> { expect(request.queryParams.by).to.equal(this…

---

## [How to stub imported Ember functions?](https://discuss.emberjs.com/t/how-to-stub-imported-ember-functions/16438)

<div class="topic-metadata">

**Author:** [@BlueRaja](https://discuss.emberjs.com/u/BlueRaja)\
**Replies:** 5\
**Last updated:** [July 18, 2021, 4:05pm UTC](https://discuss.emberjs.com/t/how-to-stub-imported-ember-functions/16438 "2021-07-18T16:05:54Z")

</div>

The old syntax looked like this: import Ember from 'ember'; ... Ember.Logger.warn(...); which was easy to stub using sinon. However, the new syntax: import { warn } from '@ember/debug'; ... warn(...); is not so easy…

---

## [Strange bugs: TailwindCSS and EmberJS](https://discuss.emberjs.com/t/strange-bugs-tailwindcss-and-emberjs/18495)

<div class="topic-metadata">

**Author:** [@gitanes](https://discuss.emberjs.com/u/gitanes)\
**Replies:** 5\
**Last updated:** [January 13, 2021, 7:10am UTC](https://discuss.emberjs.com/t/strange-bugs-tailwindcss-and-emberjs/18495 "2021-01-13T07:10:28Z")

</div>

I’m testing tailwind and ember for a musical website. I experience several bugs: in dev server, all links start with a capital letter; on some links the capital letter disappears (live demo, artists). what a strange bu…

---

## [Uncaught exception from browser breaks tests](https://discuss.emberjs.com/t/uncaught-exception-from-browser-breaks-tests/18427)

<div class="topic-metadata">

**Author:** [@dsaint](https://discuss.emberjs.com/u/dsaint)\
**Replies:** 5\
**Last updated:** [December 17, 2020, 4:10pm UTC](https://discuss.emberjs.com/t/uncaught-exception-from-browser-breaks-tests/18427 "2020-12-17T16:10:51Z")

</div>

I’m using ember-mocha and when I run my tests with Chrome I intermittently get an exception like this: Error: Uncaught NetworkError: Failed to execute 'importScripts' on 'WorkerGlobalScope': The script at 'https://local…

---

## [Testing UI and Device Media Types](https://discuss.emberjs.com/t/testing-ui-and-device-media-types/18251)

<div class="topic-metadata">

**Author:** [@zinhart](https://discuss.emberjs.com/u/zinhart)\
**Replies:** 4\
**Last updated:** [September 30, 2020, 5:10pm UTC](https://discuss.emberjs.com/t/testing-ui-and-device-media-types/18251 "2020-09-30T17:10:42Z")

</div>

Hello Everyone, Is there a way to manipulate the testing ui generated by ember test --server to simulate a mobile device, to validate the responsiveness of my application? I’m using ember-responsive and even if I choo…

---

## [How to prevent incremental storybook builds when running \`ember test -s\`?](https://discuss.emberjs.com/t/how-to-prevent-incremental-storybook-builds-when-running-ember-test-s/18048)

<div class="topic-metadata">

**Author:** [@orangesoundsnice](https://discuss.emberjs.com/u/orangesoundsnice)\
**Replies:** 0\
**Last updated:** [July 16, 2020, 3:36am UTC](https://discuss.emberjs.com/t/how-to-prevent-incremental-storybook-builds-when-running-ember-test-s/18048 "2020-07-16T03:36:55Z")

</div>

When running ember test -s , after any file save, storybook will incrementally build and slow down testing a lot. Is there a way to prevent incremental storybook buildings when running ember test -s ? Below is a screens…

---

## [Promise rejected during \<MY\_COMPONENT\_TEST\>: Cannot call \`render\` without having first called \`setupRenderingContext\`](https://discuss.emberjs.com/t/promise-rejected-during-my-component-test-cannot-call-render-without-having-first-called-setuprenderingcontext/18019)

<div class="topic-metadata">

**Author:** [@VYSHNAV\_RAJ\_S](https://discuss.emberjs.com/u/VYSHNAV_RAJ_S)\
**Replies:** 9\
**Last updated:** [July 10, 2020, 7:24am UTC](https://discuss.emberjs.com/t/promise-rejected-during-my-component-test-cannot-call-render-without-having-first-called-setuprenderingcontext/18019 "2020-07-10T07:24:15Z")

</div>

I get this strange error message when I tried to run a test for my component. Promise rejected during “MY\_COMPONENT\_TEST”: Cannot call render without having first called setupRenderingContext. I followed what has been me…

---

## [Testing strategy for legacy app with tightly coupled backend](https://discuss.emberjs.com/t/testing-strategy-for-legacy-app-with-tightly-coupled-backend/17700)

<div class="topic-metadata">

**Author:** [@Gaelan](https://discuss.emberjs.com/u/Gaelan)\
**Replies:** 1\
**Last updated:** [March 31, 2020, 2:32pm UTC](https://discuss.emberjs.com/t/testing-strategy-for-legacy-app-with-tightly-coupled-backend/17700 "2020-03-31T14:32:45Z")

</div>

I’m working on cleaning up a legacy ember app from a few years ago, and I’m hoping to write some tests to ensure my cleanup doesn’t break anything (it currently has no tests at all). The app is tightly coupled (via Ember…

[Next page](https://discuss.emberjs.com/c/testing/7.md?page=1)
