Added ES6 feature support to NodeJS Unirest codegen#197
Merged
shreys7 merged 2 commits intopostmanlabs:developfrom Mar 11, 2020
Merged
Added ES6 feature support to NodeJS Unirest codegen#197shreys7 merged 2 commits intopostmanlabs:developfrom
shreys7 merged 2 commits intopostmanlabs:developfrom
Conversation
Contributor
Author
shreys7
reviewed
Mar 9, 2020
| snippetArray = snippet.split('\n'); | ||
| expect(snippetArray[0]).to.equal('const unirest = require(\'unirest\');'); | ||
| expect(snippetArray).to.include(`const req = unirest('${mainCollection.item[0].request.method}', ` + | ||
| `'${mainCollection.item[0].request.url.raw}')`); |
Member
There was a problem hiding this comment.
Can you also add an expect for .end arrow function?
Contributor
Author
There was a problem hiding this comment.
@shreys7 Actually, initially I tried for that but don't know somehow I was getting error maybe because of some extra space.
Let me try again.
Contributor
Author
There was a problem hiding this comment.
@shreys7 I have updated, please have a look.
shreys7
approved these changes
Mar 11, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does
It allows the user to generate the code snippet for NodeJS Unirest in the ES6 format.
This is in response to issue #115 requested by one of the users.
Changes you made
Registered a new parameter ES6_enabled in
options()which allows the user to toggle between whether codegen generates snippet with ES6 features or not.By default ES6_enabled is set to
falseAlso added the newly created option parameter in
structure.test.jsfile to register it as a valid option id.Added unit tests to verify the generated snippets in snippet.test.js
Added a new mocha test suite to verify that the generated snippet is runnable in newman.test.js.
Updated the readme.md file with new option parameter.
Screenshot/ CodeSnippet
Not required
Test Configuration:
Added a unit test to check the snippet generated
Added a new block of mocha test inside the main suite to verify that the snippet produced is runnable.
Follow up
Not required
Thanks for contributing! ❤️