setupOnerror is running twice in Octane-3.15
See original GitHub issueWhen 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:
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:
- Created 4 years ago
- Reactions:2
- Comments:9 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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+.
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 theedition: 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.