Skip to content
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

debug assert no longer throwing #364

Closed
kellyselden opened this issue Apr 19, 2018 · 2 comments
Closed

debug assert no longer throwing #364

kellyselden opened this issue Apr 19, 2018 · 2 comments

Comments

@kellyselden
Copy link
Member

Not sure the right place to file this.

https://github.com/kellyselden/assert-render-bug

With code in a helper like:

Ember.assert('this is a failure');

A test the old way properly detects a failure:

test('it renders', function(assert) {
  assert.throws(function() {
    this.render(hbs`{{my-helper}}`);
  });
});

But the new way will not throw:

  test('it renders', async function(assert) {
    try {
      await render(hbs`{{my-helper}}`);
      assert.ok(false);
    } catch (err) {
      assert.ok(true);
    }
  });

  test('it renders', function(assert) {
    assert.rejects(render(hbs`{{my-helper}}`));
  });

Here are the logs:

ok 5 Chrome 65.0 - helper:my-helper: it renders
not ok 6 Chrome 65.0 - Global error: Uncaught Error: Assertion Failed: this is a failure at http://localhost:7357/assets/vendor.js, line 24725
    ---
        Log: |
            { type: 'error',
              text: 'Uncaught Error: Assertion Failed: this is a failure at http://localhost:7357/assets/vendor.js, line 24725\n' }
    ...
not ok 7 Chrome 65.0 - Integration | Helper | my-helper: it renders
    ---
        actual: >
            null
        stack: >
            http://localhost:7357/assets/vendor.js:24725
        message: >
            Uncaught Error: Assertion Failed: this is a failure
        Log: |
    ...
not ok 8 Chrome 65.0 - Global error: Uncaught Error: Assertion Failed: this is a failure at http://localhost:7357/assets/vendor.js, line 24725
    ---
        Log: |
            { type: 'error',
              text: 'Uncaught Error: Assertion Failed: this is a failure at http://localhost:7357/assets/vendor.js, line 24725\n' }
    ...
not ok 9 Chrome 65.0 - Integration | Helper | my-helper: it renders
    ---
        actual: >
            null
        stack: >
            http://localhost:7357/assets/vendor.js:24725
        message: >
            Uncaught Error: Assertion Failed: this is a failure
        Log: |
    ...

The new way throws a red error to the console, but otherwise resolves the promise normally instead of rejecting.

@Turbo87
Copy link
Member

Turbo87 commented Apr 19, 2018

seems like a duplicate of #310 to me

@kellyselden
Copy link
Member Author

Indeed it is. Sorry for not researching more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants