-
-
Notifications
You must be signed in to change notification settings - Fork 602
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
Jest and Inquirer Integration [WIP] #5
Conversation
Commit allows further testing and integration with inquirer and jest for our TDD approach. Regex could be changed to have specific test names for our purposes.
Installed rxJS and our tests are running in the travis validations.
@@ -0,0 +1,12 @@ | |||
const Rx = require('rx'); | |||
const {inquirerInput} = require('./utils/inquirer-questions.js'); |
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.
Maybe name this as inquirer-types
or inquirer-question-types
?
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.
Yeah, that's probably the best, I'll change that up
@@ -14,17 +14,32 @@ | |||
"main": "./bin/cli.js", | |||
"scripts": { | |||
"lint": "eslint ./lib", | |||
"install-commit-validator": "fit-commit-js install" | |||
"install-commit-validator": "fit-commit-js install", | |||
"test": "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.
Would be good to add these info to readme.
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.
Could do later, when we put the entire readme up?
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.
Also good to add a test-watch
script?
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 think we should also lint the tests, when we don't do it, the coding style of the tests will not be consistent with the style of the code under /lib
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.
Doing what @pksjce said we need listed probably on wednesday. Got midterms. @DanielaValero Yes! Will do! Just have to get something testable up first, collecting information so I've got enough knowledge to do this 👍
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'd also say that a watch for the test would be quite helpful when we want to code with TDD
|
||
inquirer.prompt(questions).ui.process.subscribe( | ||
(ans) => { | ||
console.log(ans); |
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.
How to test this though?
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.
For yourself: Open in GH desktop: npm link
could need a sudo flag. Type webpack-cli --init
. Through jest: Simulate an inq instance if possible.
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 could do it at a later stage though, this is just to set up the inquirer prompt, no need for testing in Jest yet.
Changes name to better reflect its usage.
FWIW - We can mock manually or use mocking patterns to do this automatically. |
Integrated new test suites and trying to get it work nicely with observable sequences.
Don't merge yet, [WIP] |
obs.next(inquirerInput('outputLogic', | ||
'What is the name of the output directory in your application?' | ||
)); | ||
obs.onCompleted(); |
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.
Instead you could,
const questions = [
inquirerInput('entryLogic','What is the name of the entry point in your application?'),
inquirerInput('outputLogic','What is the name of the output directory in your application?')];
module.exports = Rx.Observable.from(questions);
}); | ||
inquirer.prompt(questions).ui.process.subscribe(function (response) { | ||
expect(response.entryLogic).toBe('index.js') | ||
expect(response.outputLogic).toBe('output.js') |
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 don't think you need to test if inquirer
works. You only need to test what we do with the answers like they do in eslint.
In spite of the work not yet being completed, therefore theoretically ready for a code review, I have done a quick check on the current state of your branch, and would like to share some ideas, perhaps you've got them already on your sight, but wanted to share them in case you don't.
Does it make sense? |
Manually mock inquirer, allows clean test stdin and a faster testing procedure.
* Jest and Inquirer Integration [WIP] (#5) * feat: testing-and-inquirer Commit allows further testing and integration with inquirer and jest for our TDD approach. Regex could be changed to have specific test names for our purposes. * feat: installed rx and test on travis Installed rxJS and our tests are running in the travis validations. * hotfix: Change name Changes name to better reflect its usage. * feat: new test suites Integrated new test suites and trying to get it work nicely with observable sequences. * fix - Adds changes to observable questions * fix - Try to pass the build * hotfix: New test pattern Manually mock inquirer, allows clean test stdin and a faster testing procedure. * hotfix: Travis stuff * Hotfix: travis * hotfix: yarn * hotfix: travis * hotfix: new travis * hotfix * hotfix2 * hotfix: Use ES6 + prepare to squash * Fix the build
Hotfix/testing (#8) * Jest and Inquirer Integration [WIP] (#5) * feat: testing-and-inquirer Commit allows further testing and integration with inquirer and jest for our TDD approach. Regex could be changed to have specific test names for our purposes. * feat: installed rx and test on travis Installed rxJS and our tests are running in the travis validations. * hotfix: Change name Changes name to better reflect its usage. * feat: new test suites Integrated new test suites and trying to get it work nicely with observable sequences. * fix - Adds changes to observable questions * fix - Try to pass the build * hotfix: New test pattern Manually mock inquirer, allows clean test stdin and a faster testing procedure. * hotfix: Travis stuff * Hotfix: travis * hotfix: yarn * hotfix: travis * hotfix: new travis * hotfix * hotfix2 * hotfix: Use ES6 + prepare to squash * Fix the build Project Restructure
* feat: testing-and-inquirer Commit allows further testing and integration with inquirer and jest for our TDD approach. Regex could be changed to have specific test names for our purposes. * feat: installed rx and test on travis Installed rxJS and our tests are running in the travis validations. * hotfix: Change name Changes name to better reflect its usage. * feat: new test suites Integrated new test suites and trying to get it work nicely with observable sequences. * fix - Adds changes to observable questions * fix - Try to pass the build * hotfix: New test pattern Manually mock inquirer, allows clean test stdin and a faster testing procedure. * hotfix: Travis stuff * Hotfix: travis * hotfix: yarn * hotfix: travis * hotfix: new travis * hotfix * hotfix2 * hotfix: Use ES6 + prepare to squash
Commit allows further testing and integration with inquirer and jest
for our TDD approach. Regex could be changed to have specific test
names for our purposes.