-
Notifications
You must be signed in to change notification settings - Fork 28
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
Assure gts works #206
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import templateOnly from '@ember/component/template-only'; | ||
|
||
export default templateOnly(); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ import { | |
AddonHelper, | ||
assertGeneratedCorrectly, | ||
dirContents, | ||
splitHashedFiles, | ||
SUPPORTED_PACKAGE_MANAGERS, | ||
} from '../helpers.js'; | ||
|
||
|
@@ -71,13 +72,12 @@ for (let packageManager of SUPPORTED_PACKAGE_MANAGERS) { | |
|
||
expect(buildResult.exitCode).toEqual(0); | ||
|
||
let distContents = (await dirContents(distDir)).filter( | ||
// these files have a hash that changes based on file contents | ||
(distFile) => !distFile.startsWith('_rollupPluginBabelHelpers') | ||
); | ||
let distContents = splitHashedFiles(await dirContents(distDir)); | ||
let declarationsContents = await dirContents(declarationsDir); | ||
|
||
expect(distContents).to.deep.equal([ | ||
|
||
|
||
expect(distContents.unhashed).to.deep.equal([ | ||
'_app_', | ||
'components', | ||
'index.js', | ||
|
@@ -86,6 +86,18 @@ for (let packageManager of SUPPORTED_PACKAGE_MANAGERS) { | |
'template-registry.js.map', | ||
]); | ||
|
||
expect(distContents.hashed.length).toBe(4); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. rollupSomething 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) |
||
expect( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
distContents.hashed | ||
.filter(file => file.includes('_rollup')) | ||
.map(file => file.split('.js')[1]) | ||
).to.deep.equal(["", '.map'], 'the rollup helpers are emitted with a source map'); | ||
expect( | ||
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'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. 🤷 |
||
|
||
expect(declarationsContents).to.deep.equal([ | ||
'components', | ||
'index.d.ts', | ||
|
There was a problem hiding this comment.
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.