Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add some TS component blueprint tests#20771

Closed
Windvis wants to merge 4 commits intoemberjs:mainfrom
Windvis:ts-blueprint-tests
Closed

Add some TS component blueprint tests#20771
Windvis wants to merge 4 commits intoemberjs:mainfrom
Windvis:ts-blueprint-tests

Conversation

Copy link
Contributor

Windvis commented Oct 5, 2024 *
edited
Loading

While looking into #20511 I noticed there weren't any tests for the --typescript version of the blueprints.

This adds a some ts tests for the component blueprint. We can add tests for other blueprint in follow up PRs.

I included a pnpm patch for the ember-cli/ember-cli-blueprint-test-helpers package since it doesn't accept any extra cli arguments for ember new in its current state: ember-cli/ember-cli-blueprint-test-helpers#391

This also fixes a bug where ember g component foo.ts would generate .ts.hbs files since .ts wasn't normalized yet.

An extra bonus is that CI now runs a bit faster since the blueprint tests run in parallel.

Partially solves: #20362

Windvis changed the title Ts blueprint tests Add some TS component blueprint tests. Oct 5, 2024
Windvis commented Oct 5, 2024
'@babel/core':
specifier: ^7.24.4
version: 7.24.4
version: 7.24.4(supports-color@8.1.1)
Copy link
Contributor Author

Windvis Oct 5, 2024

Choose a reason for hiding this comment

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

There are a lot of lock changes, but I used the pnpm version that was listed in the package.json (8.10). I guess it's possible someone else used a different version in the past?

This comment was marked as resolved.

Windvis force-pushed the ts-blueprint-tests branch 2 times, most recently from c992cd1 to 70fc841 Compare October 5, 2024 13:25
Windvis commented Oct 5, 2024
Windvis force-pushed the ts-blueprint-tests branch from 70fc841 to bdf2e75 Compare October 5, 2024 13:30
Windvis commented Oct 5, 2024
Windvis force-pushed the ts-blueprint-tests branch from f8d59f1 to dff3a4f Compare October 5, 2024 14:08
Windvis changed the title Add some TS component blueprint tests. Add some TS component blueprint tests Oct 6, 2024
Windvis commented Oct 6, 2024
Windvis added 3 commits October 7, 2024 08:09
This setup can verify that the .ts blueprints are working as expected.
This fixes an issue where `.ts.ts` or `.ts.hbs` would be generated if
the user added the extension to the cli command: `ember g component
foo.ts`
Windvis force-pushed the ts-blueprint-tests branch from dff3a4f to f41d8ae Compare October 7, 2024 06:10
Windvis commented Oct 7, 2024
"test:blueprints:js": "EMBER_TYPESCRIPT_BLUEPRINTS=false pnpm test:blueprints:js-from-ts",
"test:blueprints:js-from-ts": "mocha node-tests/blueprints/**/*-test.js",
"test:blueprints:ts": "mocha node-tests/blueprints-ts/**/*-test.js",
"test:blueprints": "npm-run-all test:blueprints:*",
Copy link
Contributor Author

Windvis Oct 7, 2024

Choose a reason for hiding this comment

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

We can remove this one now since we no longer use it in CI, and I don't expect anyone to run all of them like this locally either.

NullVoxPopuli approved these changes Nov 4, 2024
Copy link
Contributor

NullVoxPopuli left a comment

Choose a reason for hiding this comment

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

Do you have a pr for the test-helpers as well?

normalizeEntityName(entityName) {
return normalizeEntityName(
entityName.replace(/\.js$/, '') //Prevent generation of ".js.js" files
entityName.replace(/\.(js|ts)$/, '') //Prevent generation of ".js.js" and ".ts.ts" files
Copy link
Contributor

NullVoxPopuli Nov 4, 2024

Choose a reason for hiding this comment

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

Why does js.js happen?

Copy link
Contributor Author

Windvis Nov 4, 2024

Choose a reason for hiding this comment

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

When people add an extension when generating a component: ember g component-class foo.js. I just noticed when copying one of the tests and adjusting it for .ts.

Other ts blueprints will have the same issue.

Copy link
Contributor Author

Windvis commented Nov 4, 2024 *
edited
Loading

Do you have a pr for the test-helpers as well?

No, what test-helpers do you mean?

Sorry, It seems I'm a bit slow after a 2 week holiday I haven't created a PR yet no, I can open one if the patch in this PR seems ok.

Copy link
Contributor Author

Windvis commented Nov 13, 2024 *
edited
Loading

@NullVoxPopuli Is creating a PR in the helpers repo and getting that merged / released a blocker for this one, or can we merge with the patch? That repo doesn't seem to be maintained and it has no Github actions setup either. I don't really have the time to get that repo in a good state so PRs can be merged I'm afraid.

Other than that I think I should split off the .ts.ts fix into a separate one (and fix it for all the .ts blueprints at the same time maybe?), and resolve the merge conflicts, but then this should be good to go.

NullVoxPopuli reacted with hooray emoji

Windvis mentioned this pull request Mar 1, 2025
Windvis marked this pull request as draft March 5, 2025 15:24
Copy link
Contributor Author

Windvis commented Mar 14, 2025

Going to close this since it's outdated and we can just use --typescript where needed.

Windvis closed this Mar 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

NullVoxPopuli NullVoxPopuli approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants