Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assure gts works #206

Merged
merged 3 commits into from
Sep 25, 2023
Merged

Assure gts works #206

merged 3 commits into from
Sep 25, 2023

Conversation

NullVoxPopuli
Copy link
Collaborator

Supersedes: #199
Resolves: #196

@@ -86,6 +86,18 @@ for (let packageManager of SUPPORTED_PACKAGE_MANAGERS) {
'template-registry.js.map',
]);

expect(distContents.hashed.length).toBe(4);
expect(
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

if anyone knows of a more ergonomic way to do this, I'm all ears

@@ -0,0 +1,3 @@
import templateOnly from '@ember/component/template-only';
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this file is needed so that Glint knows what type the hbs file is.

In TS, we cannot have bare-hbs-file-components.

Copy link
Collaborator

@simonihmig simonihmig left a comment

Choose a reason for hiding this comment

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

LGTM 🎉

Just have some questions about the test changes here...

@@ -86,6 +86,18 @@ for (let packageManager of SUPPORTED_PACKAGE_MANAGERS) {
'template-registry.js.map',
]);

expect(distContents.hashed.length).toBe(4);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is it 4, and is this necessarily the case? Or are we assuming rollup implementation details here, and potentially making the test brittle?

Copy link
Collaborator Author

@NullVoxPopuli NullVoxPopuli Sep 25, 2023

Choose a reason for hiding this comment

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

rollupSomething js + map
template-only js + map

Previously the rollup files were filtered out

I do not believe the test would become brittle (all 4 files have hashes in their names, so I can't directly check what their file names are)

distContents.hashed
.filter(file => file.includes('template-only'))
.map(file => file.split('.js')[1])
).to.deep.equal(["", '.map'], 'the template-only component is emitted with a source map');
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are these additional assertions related to gts support? Or why are they in this PR?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For the template-only file, it was previously un-asserted.

Since the import path changed (by adding an extension), I thought it might be good to assure the template-only component is in the dist output.

🤷

@simonihmig simonihmig added the bug Something isn't working label Sep 25, 2023
@NullVoxPopuli NullVoxPopuli merged commit 8096dc7 into main Sep 25, 2023
15 checks passed
@NullVoxPopuli NullVoxPopuli deleted the assure-gts-works branch September 25, 2023 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Typescript tests are not actually typechecking gts files Support import paths with .gts extensions
2 participants