question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Teardown with App.destroy

See original GitHub issue

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 (Responses) on my Entry model like this:

    setup: ->
      App         = startApp()
      store       = App.__container__.lookup("store:main")
      controller  = @subject()

      Ember.run ->
        store.pushPayload "entry", entryFixture
        controller.set('model', store.find('entry', entryFixture.entry.id))

    teardown: -> Ember.run(App, App.destroy)

And it works fine running a single test, but on running whole suite the first one passes then I get the following:

Setup failed on Generates #sections from catalog_definitions: Assertion Failed: Expected an object as `data` in a call to `push`/`update` for flaredown@model:response: , but was <flaredown@model:response::ember387:hbi_general_wellbeing_fd088f9929639fd742a209b4b083c421>
Source:     
Error: Assertion Failed: Expected an object as `data` in a call to `push`/`update` for flaredown@model:response: , but was <flaredown@model:response::ember387:hbi_general_wellbeing_fd088f9929639fd742a209b4b083c421>
    at new Error (native)
    at Error.EmberError (http://localhost:4300/assets/vendor.js:27425:23)
    at Object.Ember.assert (http://localhost:4300/assets/vendor.js:17039:15)
    at Ember.Object.extend.push (http://localhost:4300/assets/vendor.js:75059:15)
    at http://localhost:4300/assets/vendor.js:66195:15
    at Array.forEach (native)
    at forEach (http://localhost:4300/assets/vendor.js:27206:32)
    at extractEmbeddedHasMany (http://localhost:4300/assets/vendor.js:66193:7)
    at http://localhost:4300/assets/vendor.js:66172:15
    at http://localhost:4300/assets/vendor.js:73146:20

It seems Ember.run(App, App.destroy) is not sufficient reset the test environment back to zero? What else might need to happen here?

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:23 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
hadsycommented, May 15, 2017

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()

1reaction
timohermanscommented, Aug 20, 2015

@alvinvogelzang Thanks for the suggestion. This was indeed how we fixed it in our application, except we did in the setupController hook. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Destroy It Tear House Down - Apps on Google Play
Tear the house teardown destory it is a 3d based physics simulating game. Heavy game teardown mode: holding your weapon to tear office...
Read more >
How to destroy an angularjs app? - Stack Overflow
Using AngularJS 1.4.0, $rootScope.$destroy() is working again (as it was broken in 1.2). Using this permits to switch between several angularJS apps:
Read more >
Building Destruction on the App Store
Destroy different maps, build your own, and play with your friends and other ... down kind of like teardown mean this would become...
Read more >
How do I delete/destroy a Heroku application?
Please note, deleting an application via either method is irreversible. CLI. Use the command heroku apps:destroy to permanently delete an application. For more ......
Read more >
Can you destroy 100 000 000 voxels? - Teardown
Can you destroy 100 000 000 voxels? Steam achievements have arrived. View full event information here: Teardown Announcement Jun 16.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found