-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
console.log does not emit output #3853
Comments
@thymikee Any idea why this is happening? |
No idea, but I'd try to minimize the example, e.g. by removing typescript |
I'm able to repro without Typescript |
Can confirm Node 7.4 eats console logs, but it works on Node 7.5.0, 7.10.0, 8.0.0 and 8.1.2. |
@thymikee What about Node 6, which is the current LTS release? (Looks like I'm hitting this too, though haven't debugged it enough yet. However, I'm limited to LTS releases for now, so can't upgrade). |
Tested on v6.11.0, still shows |
Ah, I might be hitting some other problem. Thanks, @thymikee, I'll go back to debugging it a bit more. |
I was running Node 7.3.0 unknowingly (wrong version via n) and it wasn't logging. Switched to 8.1.1 and it logged again. |
@thymikee - I don't see how that is the solution? ...I am not able to upgrade my node version |
I guess I'm a little confused how this would be considered a Node bug and not at least have something to do with Jest itself. Using Node v7.4.0, with Jest v19.0.2 I see console logging from my tests. Simply updating Jest to v20.0.4 (without making any changes to any other configuration) causes console logging to no longer appear. Is there something that I'm missing? |
@thymikee So, I've upgraded my node version and I see no console logs on Node 8.2.1 Winx64 + Jest 20.0.4. I have to use a fallback for now
and I'm pretty sure it should be fixed in Jest, since previous versions didn't have this issue. |
@nowherenone can you test if it happens on latest alpha release |
@thymikee Just tried with |
I think the problem here is that Jest buffers messages but there is something that causes to bail out (or an infinite loop etc.). You'll need to use |
This is ridiculous - I am triggered by the amount of useless responses from @cpojer (in every issue and PR I go to) and trying to put everything on everyone else like somehow we aren't smart enough. Don't use Jest - that's my answer if you're wondering. Find a new testing framework.
I am sure I'll just be told to install a newer version of Node Lmao - what a joke 😂 😂 😂 |
@nf071590 cannot repro, works on repl.it with exactly the same Jest and Node versions: https://repl.it/KYLc/0 Please come up with a serious repro before ranting about project maintainers. |
Throwing in since I'm on windows (node 8.4, jest 21.0.0-alpha.2), |
Currently encountering same issue on node v8.7.0 (npm v5.4.2). |
This is still an issue |
Can you provide a reproduction? |
FWIW, I ended up here because I was having the exact same issue. Node v7.4.0. Upgraded my Node version, and That said, prior to upgrade I had the same versions as @nf071590 , and the same problems. I'm not sure why it doesn't happen on repl.it, but it's not some weird thing only happening on his computer. |
I can reproduce this with node 8.9.0 and jest 21.2.1, macOS 10.12.6 (16G1036) |
Yeah, got confused with it, sorry. Thx @tobyhinloopen
|
In that case, the log statements might be lost since the function is never called, but you should still see log statements in the original |
PR: #7731 |
I use https://www.npmjs.com/package/debug to do logging. Would that work with Jest? |
No, not until we do #6524. I'd recommend mocking |
For reference, console messages can get lost if they are printed after the tests have completed, see the comments at the bottom of #7731. This might be the reason for some, but probably not all of the missing console messages reported here. |
The --verbose worked for me. Before using --verbose, some, but not all messages were lost. I am using node v10.15.3 and jest v21.2.1 |
Still a problem for me, console logs don't show in Jest |
despite the latest announcement in the blog that the problem has been finally solved, the problem still exists, my console logs sometimes do not show up again, I'm using |
And my works just fine 🤷♂️. Please post a reproduction we can investigate. We're not wizards, we can't see your code that's failing to log output. |
actually, after investigation, logs related to API testing(like supertest) doesn't work. expected :/ |
@thymikee This is happening inconsistently so its really hard to reproduce it. example:
Now I tried to replicate same steps and the result is inconsistent. |
Provide a sample repo where it isn't working so that the JEST guys can help debug this. @kresli There is plenty of user-error possibilities as well, mostly missing |
I'll try find a time to reproduce this then. Until then I found my logs are eaten by results as you can see from bellow. Before FAIL appear you can see my 2 logs there. And also its worth to mention only 2 logs are removed. If I add 10 logs under each other, 8 would be shown. I think that's a good start :) |
Meantime, if you need a catch-all fix that just works, you can use something like With
Maybe you can even do something dirty like overriding |
@kresli what version is your jest? That looks like v23 behavior |
This keeps happening to me with |
@yaelz This is a stubbern issue that is commonly caused by user error but also has a history of hard to reproduce bugs. I think it would really help the contributors to provide a reproducable case by providing an example repo or to provide another way to reproduce the issue. |
Thanks for the quick response! |
I recently upgrade some dependencies in a project and I don't have any issue, I face this one months ago, but it was solved in newer versions I believe... |
Can you please share the versions you're using now, when it's solved?
…On Mon, Aug 5, 2019 at 12:43 PM Norman Enmanuel ***@***.***> wrote:
Thanks for the quick response!
That'll be hard because the current repo is private in my org... I'll let
you know if I get to it :)
I recently upgrade some dependencies in a project and I don't have any
issue, I face this one months ago, but I was solved in newer versions I
believe...
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3853>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AB6F4PFXDSRHBW5CMTT2DKDQC7Y2DANCNFSM4DPZ3JSA>
.
|
Sure: jest ^24.8.0 node -v v10.16.0 |
And this are some npm scripts that I use to run both, e2e, integration, unit and acceptance: "scripts": {
"test": "NODE_ENV=test npm run test:unit && npm run test:integration:both",
"test:unit": "NODE_ENV=test jest --config test/jest.config.unit.js --detectOpenHandles",
"test:integration": "NODE_ENV=test MOCK=false jest --config test/jest.config.integration.js --runInBand --detectOpenHandles",
"test:integration:mock": "NODE_ENV=test MOCK=true jest --config test/jest.config.integration.js --runInBand --detectOpenHandles",
"test:integration:both": "NODE_ENV=test npm run test:integration:mock -- --coverage; npm run db:migration:test; npm run test:integration -- --coverage;",
"test:report": "open docs/test/report/index.html",
"test:report:coverage": "open docs/test/coverage/lcov-report/index.html"
} An this is the jest.config: "use strict";
module.exports = {
"bail": true,
"verbose": false,
"collectCoverage": false,
"expand": true,
"testURL": "http://localhost:3000/",
"coverageDirectory": "./docs/test/coverage",
"testEnvironment": "node",
"rootDir": "../",
"setupFilesAfterEnv": [
"./test/jest.setup.js"
],
"jest.showCoverageOnLoad": true,
"watchPathIgnorePatterns": ["node_modules"],
"transform": {
"^.+\\.js$": "babel-jest",
'^.+\\.tsx?$': 'ts-jest',
},
"reporters": [
"default",
["./node_modules/jest-html-reporter", {
"pageTitle": "...",
"outputPath": "./docs/test/report/index.html",
"includeFailureMsg": true,
"sort": "titleAsc",
"dateFormat": "yyyy-mm-dd HH:MM:ss"
}]
]
}; Hope it helps. |
@kresli What is the status bar and time output that you have here? When I run my test suite, I see RUN HARNESS test-harness/index.js and nothing else until everything runs. I then see my console.log message at the very end and the line with RUN HARNESS... changes to <FAILED|PASS> HARNESS.... |
Update: please ignore, turned out to be an issue in my code Still facing this with node v12.16.1, jest 25.5.4, typescript 3.8.3 on MacOS. Tried the recommendations of using --runInBand, disabling/enabling verbose, using --silent=true, it didn't help. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Please try out Jest 24 if you're having issues with missing
console.log
outputBranching from Issue #2441
@cpojer I'm not seeing any console.log output with this setup (macOS):
Files
package.json
:__tests__/jestconfig.json
:__tests__/test_foo.ts
:__tests__/test_bar.js
:Output
Single JS test:
Single TS test:
The text was updated successfully, but these errors were encountered: