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.

setupOnerror is running twice in Octane-3.15

See original GitHub issue

When manually asserting an error in a component, setupOnerror is running twice, the first time err.message is the expected error, and the second time I’m receiving Cannot read property 'firstNode' of null.

Steps to reproduce:

ember new my-app
cd my-app

ember g component my-component -gc

my-component.js

import Component from '@glimmer/component';
import { assert } from '@ember/debug';


export default class MyComponentComponent extends Component {
  constructor() {
    super(...arguments);
    assert('test');
  }
}

my-component-test.js

import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render, setupOnerror } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';

module('Integration | Component | my-component', function(hooks) {
  setupRenderingTest(hooks);

  test('it does not render', async function(assert) {
    setupOnerror(function(err) {
      assert.equal(err.message, 'Assertion Failed: test');
    });
    await render(hbs`<MyComponent />`);
  });
});

The output from the above test is slightly different than my production output: ember-tests

I also tested this in the LTS version and it did not occur, it simply ran once with the expected err.message.

My apologies if this is user error.

Issue Analytics

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

github_iconTop GitHub Comments

4reactions
rwjbluecommented, Apr 16, 2020

FWIW, fixes for this are incoming. Main upstream fix (and explanation) in https://github.com/glimmerjs/glimmer-vm/pull/1073, but we are working to get those glimmer-vm changes landed in Ember releases now. Likely to be fixed for 3.16 and 3.18+.

0reactions
svsalvadorcommented, Mar 24, 2020

Hi,

I have the same issue in the project I am working right now. Triaging the error I have found that activating the optional feature application-template-wrapper the issue disappears (you must remove the edition: octane in the package.json to be able to do that).

It can be reproduced in the same repo that @ELepolt has shared: https://github.com/ELepolt/test-helpers-example.

I hope it helps.

Regards.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ember qunit tests are being called twice - Stack Overflow
I found the issue with my test. I was trying to configure the set of tests that would loaded based on a query...
Read more >
Avoid karma tests running twice on autoWatch - Marco Pracucci
A short write-up on how you can avoid karma tests running twice when autoWatch is enabled.
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