-
Notifications
You must be signed in to change notification settings - Fork 237
Conversation
Do the tests pass without the extra slashes? I'm pretty sure the linting rule is just to say: "Hey, you don't need these slashes because the code will function exactly the same without them" but I could be wrong. I understand we'd need them in a package.json, but maybe not in that string. I could be wrong 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.
Looks awesome other than that linting stuff :)
src/variable.test.js
Outdated
@@ -1,15 +1,19 @@ | |||
import isWindowsMock from 'is-windows' | |||
import varValueConvert from './variable' | |||
|
|||
const JSON_VALUE = '{\\\"foo\\\":\\\"bar\\\"}' |
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.
} | ||
``` | ||
Pay special attention to the **triple backslash** `(\\\)` **before** the **double quotes** `(")` and the **absence** of **single quotes** `(')`. | ||
Both of these conditions have to be met in order to work both on Windows and UNIX. |
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.
Wonderful! 👍
add working tests that use the same JSON value on both Windows and UNIX Closes kentcdodds#30
Codecov Report
@@ Coverage Diff @@
## master #112 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 3 3
Lines 45 45
=====================================
Hits 45 45 Continue to review full report at Codecov.
|
Alright, I have made the mentioned changes and squashed the commits. Seems good to go 👍 |
Thanks so much! |
Oh, also, would you like to add yourself to the contributors table? You can feel free to do it as an additional PR :) |
Added two tests that show the use the same JSON string on Windows and UNIX, despite not being totally sure that's how it's done. Would it be better to test against JSON.parse?
Also added a real example to the README.
I had to use the --no-verify flag, as prettier-eslint is messing up the triple backslash in the tests. What can I do to prevent that?
And just noticed that travis build is also failing precisely because of the triple backslash (lint script), despite the tests themselves running just fine.
Closes #30