-
-
Notifications
You must be signed in to change notification settings - Fork 155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Teardown with App.destroy #113
Comments
Possible duplicate: #83 |
Running into this more and more, seems related to Ember runloop. Tests pass when run individually but it seems that if the runloop isn't done when Any suggestions on how to confirm/solve this would be lovely. |
I just ran into the same issue, any way to fix this or usable workaround? My test looks very very similar to the one above. Edit: Nevermind, got my case fixed by running andThen after Ember.run in my testcase :) |
Having the same problem :-( |
One dirty way to get around this is using Ember.run.later to delay the destroy. I created an async helper to do this. // tests/helpers/start-app.js
Ember.Test.registerAsyncHelper('andLater',
function(app, callback, timeout) {
Ember.run(function() {
Ember.run.later(function() {
callback();
}, timeout || 500);
});
}
); Try to call |
I need a test case that demonstrates the problem to figure out what is happening and fix it. Can someone make a simple demo project that I could look at? |
@rwjblue By now I've managed to fix this. In our case (as in most cases I believe) it had to do with promises not passing or setting attributes on objects that have been destroyed. What I did:
|
Similar to @Chun-Yang i added a helper function https://github.com/rwjblue/ember-qunit/issues/83#issuecomment-95990645 |
@rwjblue I might have the same problem: http://emberjs.jsbin.com/mezinu/7/edit?html,css,js,output edit: I might add that if I replace the edit2: Ok this is probably not the same bug because my jsbin works when I try ember 1.10: seems I found a regression, added it as a seperate issue here: https://github.com/rwjblue/ember-qunit/issues/166 |
@Chun-Yang What do you call andLater() with? What do you pass as the callback? |
@gitjeff05 In mocha, you have
For qunit, I guess there is something equivalent. |
I experience exactly the same issue as @temo44. Also tried the ember.run.later but I'm not sure what to pass in as a callback. |
@temo44 if your properties are arrays you can probably solve it by clearing them in init like:
That solved it for me: emberjs/ember.js#10255 |
@alvinvogelzang Thanks for the suggestion. This was indeed how we fixed it in our application, except we did in the setupController hook. Thanks! |
THANK YOU! |
Ok, I think I've got a little more insight to add here. Turns out my problem was default properties on services not being reset between tests. For example, I have this service: import Ember from 'ember';
export default Ember.Service.extend({
items: [], // originally, I only had this without resetting it in `init`
init() {
this._super(...arguments)
this.set('items', [])
},
}) Once I explicitly reset |
Hey @atomkirk, here is a useful link describing the shared state issue when using arrays. https://dockyard.com/blog/2015/09/18/ember-best-practices-avoid-leaking-state-into-factories We had similar issues with tests and moved all array initialisation in to init() |
Looks like this issue has been resolved, so I'm going to close this issue. |
You dont think its a bit odd that all the apps objects arent being destroyed between tests? Is this as designed? |
@atomkirk - It isn't about destruction at all actually. Your snippet: export default Ember.Service.extend({
items: []
}); Is literally putting an array on the prototype of that service. The equivalent (in plain JS) is the following: function SomeService() {}
SomeService.prototype.items = []; This will be shared with all instances that you create. There is no way for Ember, ember-qunit, or any other thing (other than the garbage collector I suppose) to clear that array. |
I figured if the app was destroyed and recreated between every test even the prototypes were being destroyed and recreated. For example, if I set Edit: Nevermind, it clicked. The browser loads this into memory as definitions/instructions:
And then at runtime, when the app is created and run, it creates instances in memory:
|
@rwjblue ( 🍺 ) explained this to me for a very similar question a couple of years ago. It still trips me up, and everyone else on my team every once in a while. If you are going to be frustrated by this, be frustrated by javascript, not Ember 😄 |
Bumps [lerna-changelog](https://github.com/lerna/lerna-changelog) from 0.7.0 to 0.8.2. <details> <summary>Release notes</summary> *Sourced from [lerna-changelog's releases](https://github.com/lerna/lerna-changelog/releases).* > ## v0.8.2 > #### 🐛 Bug Fix > * [#125](https://github-redirect.dependabot.com/lerna/lerna-changelog/pull/125) Fix `nextVersion` config handling ([[**Turbo87**](https://github.com/Turbo87)](https://github.com/Turbo87)) > > #### 🏠 Internal > * [#124](https://github-redirect.dependabot.com/lerna/lerna-changelog/pull/124) yarn: Add `integrity` hashes ([[**Turbo87**](https://github.com/Turbo87)](https://github.com/Turbo87)) > > #### Committers: 1 > - Tobias Bieniek ([[**Turbo87**](https://github.com/Turbo87)](https://github.com/Turbo87)) > > ## v0.8.1 > #### 🚀 Enhancement > * [#117](https://github-redirect.dependabot.com/lerna/lerna-changelog/pull/117) Allow "Unreleased" commit group to be renamed ([[**alex-pex**](https://github.com/alex-pex)](https://github.com/alex-pex)) > > #### 📝 Documentation > * [#120](https://github-redirect.dependabot.com/lerna/lerna-changelog/pull/120) Add monorepo support docs ([[**jonaskello**](https://github.com/jonaskello)](https://github.com/jonaskello)) > > #### Committers: 2 > - Alexandre Paixao ([[**alex-pex**](https://github.com/alex-pex)](https://github.com/alex-pex)) > - Jonas Kello ([[**jonaskello**](https://github.com/jonaskello)](https://github.com/jonaskello)) > > > ## v0.8.0 > #### 💥 Breaking Change > * [#92](https://github-redirect.dependabot.com/lerna/lerna-changelog/pull/92) Declare Node version support (6+). ([[**Turbo87**](https://github.com/Turbo87)](https://github.com/Turbo87)) > > #### 🚀 Enhancement > * [#115](https://github-redirect.dependabot.com/lerna/lerna-changelog/pull/115) Improve CLI help output ([[**Turbo87**](https://github.com/Turbo87)](https://github.com/Turbo87)) > * [#114](https://github-redirect.dependabot.com/lerna/lerna-changelog/pull/114) Add `--from` and `--to` as replacements for `--tag-from/to` ([[**Turbo87**](https://github.com/Turbo87)](https://github.com/Turbo87)) > * [#108](https://github-redirect.dependabot.com/lerna/lerna-changelog/pull/108) Improve progress reporting ([[**Turbo87**](https://github.com/Turbo87)](https://github.com/Turbo87)) > * [#105](https://github-redirect.dependabot.com/lerna/lerna-changelog/pull/105) Ignore dependency update bots by default ([[**Turbo87**](https://github.com/Turbo87)](https://github.com/Turbo87)) > * [#103](https://github-redirect.dependabot.com/lerna/lerna-changelog/pull/103) Use `cli-highlight` to syntax highlight markdown output. ([[**Turbo87**](https://github.com/Turbo87)](https://github.com/Turbo87)) > * [#102](https://github-redirect.dependabot.com/lerna/lerna-changelog/pull/102) Improve automatic config detection. ([[**Turbo87**](https://github.com/Turbo87)](https://github.com/Turbo87)) > > #### 🐛 Bug Fix > * [#116](https://github-redirect.dependabot.com/lerna/lerna-changelog/pull/116) Fix progress bar rendering for `--no-color` ([[**Turbo87**](https://github.com/Turbo87)](https://github.com/Turbo87)) > * [#107](https://github-redirect.dependabot.com/lerna/lerna-changelog/pull/107) Fix `refName` parsing ([[**Turbo87**](https://github.com/Turbo87)](https://github.com/Turbo87)) > * [#106](https://github-redirect.dependabot.com/lerna/lerna-changelog/pull/106) Remove trailing period enforcement from PR titles ([[**Turbo87**](https://github.com/Turbo87)](https://github.com/Turbo87)) > * [#104](https://github-redirect.dependabot.com/lerna/lerna-changelog/pull/104) Add `@` sign in front of contributor login ([[**Turbo87**](https://github.com/Turbo87)](https://github.com/Turbo87)) > > #### 📝 Documentation > * [#113](https://github-redirect.dependabot.com/lerna/lerna-changelog/pull/113) Update Documentation ([[**Turbo87**](https://github.com/Turbo87)](https://github.com/Turbo87)) > > #### 🏠 Internal > * [#111](https://github-redirect.dependabot.com/lerna/lerna-changelog/pull/111) Update `progress` to v2.0.0 ([[**Turbo87**](https://github.com/Turbo87)](https://github.com/Turbo87)) > * [#112](https://github-redirect.dependabot.com/lerna/lerna-changelog/pull/112) Update `rimraf` to v2.6.2 ([[**Turbo87**](https://github.com/Turbo87)](https://github.com/Turbo87)) > * [#110](https://github-redirect.dependabot.com/lerna/lerna-changelog/pull/110) Update `p-map` to v1.2.0 ([[**Turbo87**](https://github.com/Turbo87)](https://github.com/Turbo87)) > * [#109](https://github-redirect.dependabot.com/lerna/lerna-changelog/pull/109) Update `yargs` to v11.0.0 ([[**Turbo87**](https://github.com/Turbo87)](https://github.com/Turbo87)) > * [#101](https://github-redirect.dependabot.com/lerna/lerna-changelog/pull/101) CI: Remove `node_modules` from cache. ([[**Turbo87**](https://github.com/Turbo87)](https://github.com/Turbo87)) > * [#100](https://github-redirect.dependabot.com/lerna/lerna-changelog/pull/100) package.json: Adjust changelog labels. ([[**Turbo87**](https://github.com/Turbo87)](https://github.com/Turbo87)) ></table> ... (truncated) </details> <details> <summary>Changelog</summary> *Sourced from [lerna-changelog's changelog](https://github.com/lerna/lerna-changelog/blob/master/CHANGELOG.md).* > ## v0.8.2 (2018-10-14) > > #### 🐛 Bug Fix > * [#125](https://github-redirect.dependabot.com/lerna/lerna-changelog/pull/125) Fix `nextVersion` config handling ([[**Turbo87**](https://github.com/Turbo87)](https://github.com/Turbo87)) > > #### 🏠 Internal > * [#124](https://github-redirect.dependabot.com/lerna/lerna-changelog/pull/124) yarn: Add `integrity` hashes ([[**Turbo87**](https://github.com/Turbo87)](https://github.com/Turbo87)) > > #### Committers: 1 > - Tobias Bieniek ([[**Turbo87**](https://github.com/Turbo87)](https://github.com/Turbo87)) > > > ## v0.8.1 (2018-10-10) > > #### 🚀 Enhancement > * [#117](https://github-redirect.dependabot.com/lerna/lerna-changelog/pull/117) Allow "Unreleased" commit group to be renamed ([[**alex-pex**](https://github.com/alex-pex)](https://github.com/alex-pex)) > > #### 📝 Documentation > * [#120](https://github-redirect.dependabot.com/lerna/lerna-changelog/pull/120) Add monorepo support docs ([[**jonaskello**](https://github.com/jonaskello)](https://github.com/jonaskello)) > > #### Committers: 2 > - Alexandre Paixao ([[**alex-pex**](https://github.com/alex-pex)](https://github.com/alex-pex)) > - Jonas Kello ([[**jonaskello**](https://github.com/jonaskello)](https://github.com/jonaskello)) > > > ## v0.8.0 (2018-06-19) > > #### 💥 Breaking Change > * [#92](https://github-redirect.dependabot.com/lerna/lerna-changelog/pull/92) Declare Node version support (6+). ([[**Turbo87**](https://github.com/Turbo87)](https://github.com/Turbo87)) > > #### 🚀 Enhancement > * [#115](https://github-redirect.dependabot.com/lerna/lerna-changelog/pull/115) Improve CLI help output ([[**Turbo87**](https://github.com/Turbo87)](https://github.com/Turbo87)) > * [#114](https://github-redirect.dependabot.com/lerna/lerna-changelog/pull/114) Add `--from` and `--to` as replacements for `--tag-from/to` ([[**Turbo87**](https://github.com/Turbo87)](https://github.com/Turbo87)) > * [#108](https://github-redirect.dependabot.com/lerna/lerna-changelog/pull/108) Improve progress reporting ([[**Turbo87**](https://github.com/Turbo87)](https://github.com/Turbo87)) > * [#105](https://github-redirect.dependabot.com/lerna/lerna-changelog/pull/105) Ignore dependency update bots by default ([[**Turbo87**](https://github.com/Turbo87)](https://github.com/Turbo87)) > * [#103](https://github-redirect.dependabot.com/lerna/lerna-changelog/pull/103) Use `cli-highlight` to syntax highlight markdown output. ([[**Turbo87**](https://github.com/Turbo87)](https://github.com/Turbo87)) > * [#102](https://github-redirect.dependabot.com/lerna/lerna-changelog/pull/102) Improve automatic config detection. ([[**Turbo87**](https://github.com/Turbo87)](https://github.com/Turbo87)) > > #### 🐛 Bug Fix > * [#116](https://github-redirect.dependabot.com/lerna/lerna-changelog/pull/116) Fix progress bar rendering for `--no-color` ([[**Turbo87**](https://github.com/Turbo87)](https://github.com/Turbo87)) > * [#107](https://github-redirect.dependabot.com/lerna/lerna-changelog/pull/107) Fix `refName` parsing ([[**Turbo87**](https://github.com/Turbo87)](https://github.com/Turbo87)) > * [#106](https://github-redirect.dependabot.com/lerna/lerna-changelog/pull/106) Remove trailing period enforcement from PR titles ([[**Turbo87**](https://github.com/Turbo87)](https://github.com/Turbo87)) > * [#104](https://github-redirect.dependabot.com/lerna/lerna-changelog/pull/104) Add `@` sign in front of contributor login ([[**Turbo87**](https://github.com/Turbo87)](https://github.com/Turbo87)) > > #### 📝 Documentation > * [#113](https://github-redirect.dependabot.com/lerna/lerna-changelog/pull/113) Update Documentation ([[**Turbo87**](https://github.com/Turbo87)](https://github.com/Turbo87)) > > #### 🏠 Internal > * [#111](https://github-redirect.dependabot.com/lerna/lerna-changelog/pull/111) Update `progress` to v2.0.0 ([[**Turbo87**](https://github.com/Turbo87)](https://github.com/Turbo87)) > * [#112](https://github-redirect.dependabot.com/lerna/lerna-changelog/pull/112) Update `rimraf` to v2.6.2 ([[**Turbo87**](https://github.com/Turbo87)](https://github.com/Turbo87)) ></table> ... (truncated) </details> <details> <summary>Commits</summary> - [`8ae7803`](lerna/lerna-changelog@8ae7803) v0.8.2 - [`01ac435`](lerna/lerna-changelog@01ac435) Update Changelog - [`17b2a9c`](lerna/lerna-changelog@17b2a9c) Merge pull request [#125](https://github-redirect.dependabot.com/lerna/lerna-changelog/issues/125) from Turbo87/config-fix - [`dfe0b1d`](lerna/lerna-changelog@dfe0b1d) Fix `nextVersion` config handling - [`958dc28`](lerna/lerna-changelog@958dc28) Merge pull request [#124](https://github-redirect.dependabot.com/lerna/lerna-changelog/issues/124) from Turbo87/integrity - [`e135748`](lerna/lerna-changelog@e135748) yarn: Add `integrity` hashes - [`17c835d`](lerna/lerna-changelog@17c835d) v0.8.1 - [`15b8076`](lerna/lerna-changelog@15b8076) Update Changelog - [`35b6fa8`](lerna/lerna-changelog@35b6fa8) Add monorepo support docs ([#120](https://github-redirect.dependabot.com/lerna/lerna-changelog/issues/120)) - [`6fc2941`](lerna/lerna-changelog@6fc2941) Merge pull request [#117](https://github-redirect.dependabot.com/lerna/lerna-changelog/issues/117) from alex-pex/feature/set-next-version - Additional commits viewable in [compare view](lerna/lerna-changelog@v0.7.0...v0.8.2) </details> <br /> [![Dependabot compatibility score](https://api.dependabot.com/badges/compatibility_score?dependency-name=lerna-changelog&package-manager=npm_and_yarn&previous-version=0.7.0&new-version=0.8.2)](https://dependabot.com/compatibility-score.html?dependency-name=lerna-changelog&package-manager=npm_and_yarn&previous-version=0.7.0&new-version=0.8.2) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. Dependabot will **not** automatically merge this PR because it includes an out-of-range update to a development dependency. --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot ignore this [patch|minor|major] version` will close this PR and stop Dependabot creating any more for this minor/major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) - `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language - `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language - `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language - `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language - `@dependabot badge me` will comment on this PR with code to add a "Dependabot enabled" badge to your readme Additionally, you can set the following in your Dependabot [dashboard](https://app.dependabot.com): - Update frequency (including time of day and day of week) - Automerge options (never/patch/minor, and dev/runtime dependencies) - Pull request limits (per update run and/or open at any time) - Out-of-range updates (receive only lockfile updates, if desired) - Security updates (receive only security updates, if desired) Finally, you can contact us by mentioning @dependabot. </details>
I've been searching like crazy to nail down this bug, and I think it has to do with qunit setup/teardown.
Loading some embedded records (
Response
s) on myEntry
model like this:And it works fine running a single test, but on running whole suite the first one passes then I get the following:
It seems
Ember.run(App, App.destroy)
is not sufficient reset the test environment back to zero? What else might need to happen here?The text was updated successfully, but these errors were encountered: