-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Use console-testing-library
to get consistent snapshots
#277
Conversation
Deploy preview for redux-starter-kit-docs ready! Built with commit 9484114 https://deploy-preview-277--redux-starter-kit-docs.netlify.com |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 9484114:
|
Now both CIs work nicely - thank you very much! |
Hmm. I just pulled master, and the serializable test file is failing with:
Any idea what's going on here? Does this work on Windows? |
It specifically seems to be the test on line 83, If I skip that one, everything else passes:
If I include it, the test file fails with no actual error output:
I want to get 1.2.0 out, but this needs to be resolved first. Can one of you take a look at this? |
@markerikson I’ve seen similar result on older version of node 13, I’ve resolved it by just upgrading node to the latest version. What version are you on? |
13.2, looks like. What about the lib makes it dependent on a specific Node version that way, and why aren't all the other tests failing like that too? |
TBH, I just assumed it to be a node bug, I haven’t looked into the root cause. Related issue nodejs/node#30730, jestjs/jest#8769 |
Uh.... I just commented out the entire body of that test, and the test run still dies the same way. But, if I wat. |
Looks like node 13.2 specifically is the only node version which has this problem, and it’s somehow unpredictable, at least in user-land |
I'll try upgrading Node when I'm free later. |
Currently I assume that this is some kind of memory leak in https://github.com/kevin940726/console-testing-library/blob/master/index.js#L177-L194 that only appears on node 13.2 with a minimum amount of tests being run - but I don't have a system where I could reproduce it. @kevin940726 , could you keep investigating please? |
yeah sure! but we’re around 3 am here, let me do it tmr 😅 |
Sure :D get some sleep! |
Did some digging, unfortunately nothing new. Found out that it's a V8 bug, which has been fixed in Node. The bug has been happening in many tests, but what exactly triggers it is still unknown to me. I don't think it'd be a blocker since it's just a dev dep, and we could just upgrade our node version to the latest. However, I will keep an eye on this and hope that we don't introduce any potential bugs. |
Well, given it's a known (and fixed) node bug that leads to a real segfault, that would be fine with me personally. Depends on what @markerikson thinks about it. One thing though: After reviewing this a second time, I'm not too fond that this automatically does a PS: maybe you could add a line to your lib that detects 13.2 and just writes a warning to the console and opts out of doing anything if that's the case? It's better having some failing tests and a readable warning than a segfault. |
Yeah the manual cleaning up makes sense to me. Thanks for the suggestion! The problem is that I’m not totally sure what causes the problem, from my understanding so far is it’s a bug related to global inline cache. A warning would be nice but at the same time it might seems overly aggressive. FWIW it never happens in the test of the lib itself 🤔 |
I tried pulling |
As mentioned in #271 (comment),
console-testing-library
is a simple package I built to help test console output more align to what users see.It's new, so it's probably not stable for every cases, but I think it's quite stable for our simple use case.
Under the hood, it uses
new Console()
as in #257 did, and also usespretty-format
from jest to generate consistent output across different node versions.