adopted-ember-addons / ember-qunit-nice-errors

Because expected true, result false is not enough!
http://wyeworks.github.io/ember-qunit-nice-errors/
MIT License
56 stars 12 forks source link

Async Await Test setup #18

Closed snewcomer closed 8 years ago

snewcomer commented 8 years ago

Seems to not work if tests setup w/ async await. Any thoughts?

fedekau commented 8 years ago

@snewcomer Can you please provide an example of a test where the addon doesn't do it's magic? That's always a helpful and nice thing to have :grinning:

snewcomer commented 8 years ago

@fedekau Here is the acceptance test. Seems to be somewhere linked to the TestTransformFilter.

https://github.com/snewcomer/ember-qunit-nice-errors/commits/master

screen shot 2016-07-21 at 4 31 45 pm

fedekau commented 8 years ago

@snewcomer Thanks, we will take a look at this!

les2 commented 8 years ago

Cannot update unless this is fixed :(

I can reproduce in my project. Tried updating and a unit testing that uses assert.async() fails.

Beginning of test has this:

  let done = assert.async();
  assert.expect(7);

Failure message is this:

    ✘ Expected assert.expect(7) assertions, but 7 were run
            at testWrapper (http://localhost:7357/assets/addon-test-support/ember-qunit/test-wrapper.js:44:1)
            at test (http://localhost:7357/assets/addon-test-support/ember-qunit/test.js:11:1)
            at test (http://localhost:7357/assets/performance/tests/ember-sinon-qunit/test.js:31:1)

I gotta run to a kids birthday part soon but later I'll try to distill to a reproducible example.

les2 commented 8 years ago

@fedekau minimal ember project demonstrating the bug: https://github.com/les2/ember-qunit-nice-errors-issue-18

(see readme) or just git log to see what happens from ember init.

let me know if there or questions.

now going to that party! getting yelled at now!

fedekau commented 8 years ago

@les2 I am sorry to hear that. The are two issues that can aid with this problem, see #20 & #35. They will not fix the error, but at least they will unblock you from using the addon 😄, we will try to tackle that in the next weeks (or you can do a PR, that is always welcome!)

The problem, we believe, is related with the parser we are using, which is recast which does not support aync and await.

We are planing to use a different one, for example babylon.

I will take a look at the example, thanks for that!

Have fun, and don't eat too much 🍰 !

sdebarros commented 8 years ago

@fedekau @les2 I think the issue in this case is different than the one reported first, it's not caused by calling assert.async, but by enabling completeExistingMessages. Created a new issue for this https://github.com/wyeworks/ember-qunit-nice-errors/issues/38

san650 commented 8 years ago

@fedekau @acostami @sdebarros I'm rewriting the transformation as a Babel Plugin, I have a working version already but I have to clean up the code first before submitting the PR. The advantage of having this as a babel plugin is that it will support any notation supported by Babylon (the babel parser).

So if you add the babel async functions to your project, this addon will work because we will use the same parser.