-
-
Notifications
You must be signed in to change notification settings - Fork 601
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
tests(generator): enhance init generator tests #1236
Conversation
Thank you for your pull request! The most important CI builds succeeded, we’ll review the pull request soon. |
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.
Your test is failing. Check the logs.
@@ -1,7 +1,7 @@ | |||
import { join } from 'path'; | |||
import { run } from 'yeoman-test'; | |||
const assert = require('yeoman-assert'); |
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.
Use the import
. You are under TypeScript here
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.
Tried it but it wasn't working with this package. :(
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.
That's probably because you didn't install the types
@@ -1,7 +1,7 @@ | |||
import { join } from 'path'; |
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.
You should install also @types/yeoman-assert
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.
Right, will make the changes, good catch. 👍
|
||
// Check that all the project files are generated with the correct name | ||
const filePaths = ['package.json', 'README.md', 'src/index2.js']; | ||
assert.file([...filePaths.map(file => join(outputDir, 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.
I had to skip the other tests that I merged because they were failing. You should use the jest assertion in order to tell to jest that is working. Or checking yeoman-assert
documentation to understand how to integrate it with 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.
Okay, sounds fair, will take a look. 👍
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.
Is it a problem with yeoman-assert? I can't seem to find a way to integrate them with jest and the docs are really minimal.
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.
Triggered travis on next again and it seems to pass now. 😟🤔
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.
Check the logs locally while you test them (maybe run that single test). There are errors and jest can't recognize any assertion so it's like the test is empty
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.
At this point do not use yeoman-assert
and stick with the normal expect
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.
Check the logs locally while you test them (maybe run that single test). There are errors and jest can't recognize any assertion so it's like the test is empty
I just ran a test which was supposed to fail in yeoman-assert and jest caught it, I think the errors from yeoman-assert are caught by jest on exit.
This is from the logs
|
Thanks! I wonder how it's failing now when it was fine before. Unusual. Anyways, will take a look. 👍 |
Why is snyk failing? Does anybody have any ideas around it? And what packages is it failing for? |
I merged the PR where we moved the main cli under lerna. Also, we switched to yarn. You should use that now :) |
Thanks for the heads up! Will rebase and do the changes in a while. Thanks! |
enhance init generator tests
fix docs typo
a402d96
8e50a03
to
a402d96
Compare
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.
Is the assertion now working?
@rishabh3112 Thanks for your update. I labeled the Pull Request so reviewers will review it again. @ematipico Please review the new changes. |
Thanks! |
Thanks for the rebase! 😄 |
enhance init generator tests
What kind of change does this PR introduce?
tests
Did you add tests for your changes?
Yay
If relevant, did you update the documentation?
NA
Summary
Does this PR introduce a breaking change?
No
Other information