-
Notifications
You must be signed in to change notification settings - Fork 3
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
Added a config file generation feature #82
Conversation
The artifact generator now can receive two main commands: generate (to generate artifacts), and init, to initialize a default config file.
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.
Just a number of small tidy ups.
- Fixed grammatical mistakes in the template - Removed FIXME comments - Added comment at the top of the template to give details about generation. This required moving some code from ArtifactGenerator.js to App.js to prevent redundancy
The generator successfully does nothing when running on a freshly generated yaml file.
artifactVersion: '1.0.0', | ||
moduleNamePrefix: '@lit/generated-vocab-', | ||
}); | ||
await expect(artifactGenerator.generate()).rejects.toThrow(NoVocabularyProvidedError); |
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.
Remove the error class, and just check that the exception message contained the name of the file and the string 'No vocabularies found'.
Shouldn't this assertion also contain a helpful text message on failure too?
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.
I'm not sure to understand what you mean in your last sentence. I added comments, but I did not find a way to add a comment displayed in case of failure to expect(...) as we do it in JUnit. I might lack understanding of the test framework: what is the relation between Jest and Jasmine ? Because it seems that the function .withContext()
, provided by Jasmine, would do the trick, but it is not documented in jest.
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.
See the answer here: https://stackoverflow.com/questions/45678706/how-to-provide-chai-expect-with-custom-error-message-for-mocha-unit-test (i.e. optional message param to expect()
).
Ah wait, seems that was a Chai feature, and Jest doesn't support it the same way. Hhhmmmm.... let me look into it more.
I haven't been doing it (i.e. adding a descriptive error message), but for all new code, I think we should add one (as we're now doing for Java).
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.
Seems to be a known issue with Jest: jestjs/jest#3293
Seems adding 'https://github.com/mattphillips/jest-expect-message' will work, and make it work like Chai (and JUnit) - so maybe add a ticket to add that later (i.e. on the Wishlist!).
- Removed commented out blocks - Improved English in some comments
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.
Just one minor test assertion tidy-up, otherwise LGTM.
- Only invoke generate once - Use a constant instead of copying the file name
Resolves #75
The artifact generator now can receive two main commands: generate (to generate artifacts), and init, to initialize a default config file. A lot of code moved around in index.js, but actually the previous functionalities are preserved under the
node index generate
command, which required some refactoring. Using yargs commands prepares for the addition of new functionalities, such as starting/stopping the daemon (see #74)