-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
Escape double quotes in string prompts #388
Conversation
Can you add a test case for this? |
I'm not home anymore, but I can do this tomorrow ;)
If I understood you correctly, the test should just verify that the
package.json is valid JSON?
Eduardo San Martin Morote <notifications@github.com> schrieb am Mi., 8.
März 2017, 12:06:
… Can you add a test case for this?
You can reuse one of the tests and verify that the generated package json
is correct by parsing it
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#388 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AGmW1mhfIipGhuBJZ0PPNiHdfsHqKufrks5rjovQgaJpZM4MWozV>
.
|
Yes, so that the double quotes are escaped correctly |
Okay, I think that I should be able to do this :)
Eduardo San Martin Morote <notifications@github.com> schrieb am Mi., 8.
März 2017, 12:12:
… Yes, so that the double quotes are escaped correctly
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#388 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AGmW1u7SGg_c2hPFkMA8uBfdErK3GtGbks5rjo0jgaJpZM4MWozV>
.
|
I just added a test to check the escaping. I tired to leave the other tests alone and add it seperately... May not be the best test, but it should do the trick 😄 |
test/e2e/test.js
Outdated
const pkg = fs.readFileSync(`${MOCK_TEMPLATE_BUILD_PATH}/package.json`, 'utf8') | ||
try { | ||
var validData = JSON.parse(pkg) | ||
expect(validData.author).to.equal(escapedAuthor) |
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.
Can't you just do expect(validData.author).to.equal(escapedAnswers.author)
?
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.
Jup, could definitively do that.... My mistake 😂
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 woke up an hour ago, still not very awake
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.
LGTM 👍 |
This fixes #382.
It checks if the answer type is
string
, and if it is,replace
s"
with\"
, so it can be parsed as valid JSON.