You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I always get the weirdest issues. So, serialize-javascript works fine in actual production, but it somehow outputs a different thing while running a test. In the example of the object with all the types including the function, I get an odd line return within the serialized function.
Hello, I watch several random repositories and I have seen some odd issues involving things working in production but failing within jest... My guess is that jest is taking your source code and messing with it somehow before running the test, in a way that usually does not make a difference... Of course adding newlines to a function definition like this only makes a difference if you are stringifying the function content (which is extremely rare), so jest developers probably didn't even think about it.
The above is just a guess...
I don't know where to begin in troubleshooting it.
I suggest using another testing library to see if the problem persists. I like ava. This would be a good step to decide whether or not jest is the culprit.
I am, however, not convinced this is only jest-related, however. https://repl.it/@evie_codes/BogusTrustworthyBases#index.js for another way to reproduce this. The data is being sent to repl.it's database and returns with the exact same line returns. I don't know what causes this but jest doesn't seem to be the only thing.
I always get the weirdest issues. So, serialize-javascript works fine in actual production, but it somehow outputs a different thing while running a test. In the example of the object with all the types including the function, I get an odd line return within the serialized function.
Environment:
Reproduction:
(Alternatively, see https://gist.github.com/eslachance/6dbd88820f09de4509d4f19c4c0e7ad6 for reproduction)
Expected result:
Actual Result:
The expected result was a simple nodejs file which outputs the serialized data and nothing else.
This is confusing me very much, and I don't know where to begin in troubleshooting it.
The text was updated successfully, but these errors were encountered: