Skip to content

fix ember 3.x-lts#2648

Merged
mansona merged 1 commit intoemberjs:mainfrom
patricklx:fix-ember-lts
Jun 6, 2025
Merged

fix ember 3.x-lts#2648
mansona merged 1 commit intoemberjs:mainfrom
patricklx:fix-ember-lts

Conversation

@patricklx
Copy link
Copy Markdown
Collaborator

@patricklx patricklx commented Jun 4, 2025

Description

  • the application route/controller/template of inspector ui was beeing indirectly used in ember_debug tests, which is not required and broke older lts tests
  • the override of the adapter was happening to early and then it was again overridden in inspector ui init/setup
  • port is not necessary for injection test and is breaking older lts tests, override with empty service

@patricklx patricklx changed the title Fix ember lts fix ember lts Jun 4, 2025
@patricklx patricklx force-pushed the fix-ember-lts branch 16 times, most recently from 8c681aa to b510ccb Compare June 6, 2025 12:04
Copy link
Copy Markdown
Contributor

@BlueCutOfficial BlueCutOfficial left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @patricklx, I like how small and focused that PR is, it makes it easy to review and comment 👍 I posted a few questions / notes before approving.

Comment on lines +16 to +18
constructor(...args: unknown[]) {
// @ts-expect-error ignore
super(...args);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need this change?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in 3.16 it fails with

Assertion Failed: An EmberObject based class, (unknown), was not instantiated correctly. You may have either used `new` instead of `.create()`, or not passed arguments to your call to super in the constructor: `super(...arguments)`. If you are trying to use `new`, consider using native classes without extending from EmberObject.

teardownContext,
} from '@ember/test-helpers';
import { run } from '@ember/runloop';
import ERouter from '@ember/routing/route';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What idea do you want to express with the name ERouter?

Copy link
Copy Markdown
Collaborator Author

@patricklx patricklx Jun 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Router was already used further down... and EmberRouter as well, any other good naming suggestion is welcome :D

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What you're importing is from @ember/routing/route though, to "reset" the application route and prevent the UI one from triggering side effects. So I would rather go with Route, I don't think this one is used already in the file.

}
});
});
owner.register('service:port', class extends Service {});
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know more precisely what part was causing the old tests to break?

Copy link
Copy Markdown
Collaborator Author

@patricklx patricklx Jun 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the port service there is an import of internal @ember/-internals/metal, which didn't exist in older ember


Application.initializer({
name: `00-override-adapter`,
name: `setup-2-override-adapter`,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question about the name, what does it express?

Copy link
Copy Markdown
Collaborator Author

@patricklx patricklx Jun 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the name of the initialiser in init/setup is setup.
this ensures that this initialiser is sorted after ui inspector setup initializer

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we add a small in-code comment for that as well? 🙏

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔️

Comment on lines +56 to +65
this.owner.register('route:application', class extends ERouter {});
this.owner.register('controller:application', class extends Controller {});
this.owner.register('template:application', hbs('{{outlet}}'));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel that these lines deserve a comment in the code, to help understand how the tests are structured. Something similar to what the PR description says, but phrased for someone who starts looking at this with no context.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔️

Comment on lines +56 to +62
/**
* preferably, ember debug tests should use their own test app
* but currently its mangled with the inspector ui app, which is not compatible with all ember versions being tested.
* we do filter the tests to only run the ember_debug tests, but that does not prevent the app merging.
* The application route/controller/template of inspector ui was being indirectly used in ember_debug tests,
* which is not required and broke older lts tests
*/
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

@patricklx patricklx changed the title fix ember lts fix ember 3.x-lts Jun 6, 2025
@mansona mansona merged commit 5fe4118 into emberjs:main Jun 6, 2025
19 checks passed
@github-actions github-actions bot mentioned this pull request Jun 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants