Skip to content

A component that throws on first render breaks every test after it #21767

Open

Description

@amk221

🐞 Describe the Bug

I use assert() in my components to tell other developers when they've used a component wrongly, e.g. a required argument is missing. I test those asserts, so I know the guidance actually fires:

class Avatar extends Component {
  constructor() {
    super(...arguments);
    assert('@size must be set', this.args.size);
  }
}
test('it asserts @size is set', async function (assert) {
  setupOnerror((error) => {
    assert.strictEqual(error.message, 'Assertion Failed: @size must be set');
  });

  await render(<template><Avatar /></template>);
});

This used to work. Since upgrading to ember-source 7.3, the test still passes, but every test that runs after it logs:

Attempted to rerender, but the Ember application has had an unrecoverable error occur during render. You should reload the application after fixing the cause of the error.

In our app, five tests like this produce about a million warnings across the suite, so for now I've had to skip them.

🔬 Minimal Reproduction

https://github.com/amk221/-ember-render-component-leak

A fresh Ember CLI 7.3.0 app with one test file added. Run pnpm test.

The first test renders a component that throws on its first render and handles it with setupOnerror. It uses a plain throw to keep it minimal, which behaves the same as assert(). The second test renders something unrelated and checks that nothing was logged.

😕 Actual Behavior

The second test fails because the warning is logged while it runs. On its own, it passes.

🤔 Expected Behavior

I can test that a component asserts on wrong usage, without it affecting the tests that run after it.

🌍 Environment

  • Ember: 7.3.1 (@ember/test-helpers 5.7.0)
  • Ember-CLI: 7.3.0
  • Node.js/npm: Node 24.16.0, pnpm 12.11.2
  • OS: macOS
  • Browser: Chrome 155

➕ Additional Context

This looks like the "second, related leak" mentioned in #21681. That issue was closed by a fix for a different problem, so I've opened this one to track it.

Activity

  1. ijlee2 commented on Oct 23, 2026

    @ijlee2
    SponsorMember

    I also started seeing Attempted to rerender in ember-intl's test app, which has a few tests that use setupOnerror and resetOnerror to check assert from @ember/debug. The message can also be seen in a browser's console when we visit /tests.

    Based on the recent CI run, if the regression had occurred in ember-source, it might have occurred between 6.0 and 6.12. (Open Test to see the logs.)

  2. NullVoxPopuli commented on Oct 23, 2026

    @NullVoxPopuli
    SponsorContributor

    Thanks for the issue report and reproduction! I'm not yet at a computer, but can you see if this also affects canary/alpha?

  3. amk221 commented on Oct 23, 2026

    @amk221
    Author

    passes in canary, possibly an accidental fix, not a targeted one

  4. NullVoxPopuli commented on Oct 23, 2026

    @NullVoxPopuli
    SponsorContributor

    Legit, so something needs backported perhaps

  5. NullVoxPopuli commented on Nov 30, 2026

    @NullVoxPopuli
    SponsorContributor

    @ijlee2 / @amk221 can you check latest beta/canary/release patches? I forget if we got this backported

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions